update_payload: Fix checker unittests.
Checker unittests failed when fail_bad_type=True in
DoCheckOperationsTest. When the operation was added (in AddOperation), a
ValueError was raised because an invalid enum value (for op.type) was
given. For now, fail_bad_type tests have been removed.
BUG=None
TEST=`./checker_unittest.py`
Change-Id: I19220e295c576b4ddc6f427dedd4bc037908483d
Reviewed-on: https://chromium-review.googlesource.com/264005
Reviewed-by: Allie Wood <alliewood@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
diff --git a/scripts/update_payload/checker_unittest.py b/scripts/update_payload/checker_unittest.py
index c07819a..eb8b564 100755
--- a/scripts/update_payload/checker_unittest.py
+++ b/scripts/update_payload/checker_unittest.py
@@ -922,8 +922,7 @@
result = payload_checker._AllocBlockCounters(16 * block_size + 1)
self.assertEqual(17, len(result))
- def DoCheckOperationsTest(self, fail_bad_type,
- fail_nonexhaustive_full_update):
+ def DoCheckOperationsTest(self, fail_nonexhaustive_full_update):
# Generate a test payload. For this test, we only care about one
# (arbitrary) set of operations, so we'll only be generating kernel and
# test with them.
@@ -936,12 +935,6 @@
# Fake rootfs operations in a full update, tampered with as required.
rootfs_op_type = common.OpType.REPLACE
- if fail_bad_type:
- # Choose a type value that's bigger than the highest valid value.
- for valid_op_type in common.OpType.ALL:
- rootfs_op_type = max(rootfs_op_type, valid_op_type)
- rootfs_op_type += 1
-
rootfs_data_length = rootfs_part_size
if fail_nonexhaustive_full_update:
rootfs_data_length -= block_size
@@ -958,10 +951,9 @@
payload_checker.payload_type = checker._TYPE_FULL
report = checker._PayloadReport()
- should_fail = (fail_bad_type or fail_nonexhaustive_full_update)
args = (payload_checker.payload.manifest.install_operations, report,
'foo', 0, rootfs_part_size, rootfs_part_size, 0, False)
- if should_fail:
+ if fail_nonexhaustive_full_update:
self.assertRaises(update_payload.PayloadError,
payload_checker._CheckOperations, *args)
else:
@@ -1240,8 +1232,7 @@
# Add all _CheckOperations() test cases.
AddParametricTests('CheckOperations',
- {'fail_bad_type': (True, False),
- 'fail_nonexhaustive_full_update': (True, False)})
+ {'fail_nonexhaustive_full_update': (True, False)})
# Add all _CheckOperations() test cases.
AddParametricTests('CheckSignatures',