summaryrefslogtreecommitdiff
path: root/scripts/update_payload/checker_unittest.py
diff options
context:
space:
mode:
authorAllie Wood <alliewood@chromium.org>2015-04-03 14:25:48 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-06 21:50:28 +0000
commitfb04d30e433eed1d7e7b78114c1a747c89091362 (patch)
tree63aea6f15a51fb9c092aa661ecbff83ecf5db423 /scripts/update_payload/checker_unittest.py
parent7cf9f13f2715d0a033c6300a244b40302d8eb7b7 (diff)
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>
Diffstat (limited to 'scripts/update_payload/checker_unittest.py')
-rwxr-xr-xscripts/update_payload/checker_unittest.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/scripts/update_payload/checker_unittest.py b/scripts/update_payload/checker_unittest.py
index c07819aa..eb8b5644 100755
--- a/scripts/update_payload/checker_unittest.py
+++ b/scripts/update_payload/checker_unittest.py
@@ -922,8 +922,7 @@ class PayloadCheckerTest(mox.MoxTestBase):
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 @@ class PayloadCheckerTest(mox.MoxTestBase):
# 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 @@ class PayloadCheckerTest(mox.MoxTestBase):
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 @@ def AddAllParametricTests():
# 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',