summaryrefslogtreecommitdiff
path: root/scripts/update_payload/checker_unittest.py
diff options
context:
space:
mode:
authorAmin Hassani <ahassani@google.com>2018-03-08 15:48:59 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-03-23 14:51:11 -0700
commita86b108fc604d296edbd3f6c158a17175ef6f9fe (patch)
tree676c8ff56725a680fecc47584223d1164d09f46d /scripts/update_payload/checker_unittest.py
parent89afe86b007d21d11f3d4b6e139d300b411d2e17 (diff)
update_payload: Allow check for given metadata size
Allow passing metadata size to check_update_payload so we can verify the metadata size in omaha equals to the one in the payload. BUG=chromium:820243 TEST=run paycheck.py with both valid and invalid metadata sizes reports as expected TEST=unittests Change-Id: Ib41ce77af77636fffec6752201c363e7fbbf868d Reviewed-on: https://chromium-review.googlesource.com/955679 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
Diffstat (limited to 'scripts/update_payload/checker_unittest.py')
-rwxr-xr-xscripts/update_payload/checker_unittest.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/update_payload/checker_unittest.py b/scripts/update_payload/checker_unittest.py
index f7182342..68f18078 100755
--- a/scripts/update_payload/checker_unittest.py
+++ b/scripts/update_payload/checker_unittest.py
@@ -1127,8 +1127,8 @@ class PayloadCheckerTest(mox.MoxTestBase):
def DoRunTest(self, rootfs_part_size_provided, kernel_part_size_provided,
fail_wrong_payload_type, fail_invalid_block_size,
- fail_mismatched_block_size, fail_excess_data,
- fail_rootfs_part_size_exceeded,
+ fail_mismatched_metadata_size, fail_mismatched_block_size,
+ fail_excess_data, fail_rootfs_part_size_exceeded,
fail_kernel_part_size_exceeded):
"""Tests Run()."""
# Generate a test payload. For this test, we generate a full update that
@@ -1178,6 +1178,11 @@ class PayloadCheckerTest(mox.MoxTestBase):
else:
use_block_size = block_size
+ # For the unittests 246 is the value that generated for the payload.
+ metadata_size = 246
+ if fail_mismatched_metadata_size:
+ metadata_size += 1
+
kwargs = {
'payload_gen_dargs': {
'privkey_file_name': test_utils._PRIVKEY_FILE_NAME,
@@ -1196,9 +1201,10 @@ class PayloadCheckerTest(mox.MoxTestBase):
kwargs = {'pubkey_file_name': test_utils._PUBKEY_FILE_NAME,
'rootfs_part_size': rootfs_part_size,
+ 'metadata_size': metadata_size,
'kernel_part_size': kernel_part_size}
should_fail = (fail_wrong_payload_type or fail_mismatched_block_size or
- fail_excess_data or
+ fail_mismatched_metadata_size or fail_excess_data or
fail_rootfs_part_size_exceeded or
fail_kernel_part_size_exceeded)
if should_fail:
@@ -1353,6 +1359,7 @@ def AddAllParametricTests():
'kernel_part_size_provided': (True, False),
'fail_wrong_payload_type': (True, False),
'fail_invalid_block_size': (True, False),
+ 'fail_mismatched_metadata_size': (True, False),
'fail_mismatched_block_size': (True, False),
'fail_excess_data': (True, False),
'fail_rootfs_part_size_exceeded': (True, False),