diff options
author | Amin Hassani <ahassani@chromium.org> | 2017-12-15 17:45:49 +0000 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-12-15 22:19:46 -0800 |
commit | b44f73baa8d302a077ab1c0c73eac63bd02350e5 (patch) | |
tree | 35b86db22317dd8be45863ee69b722666bb949a2 /scripts/update_payload/checker_unittest.py | |
parent | 717c324c334cc3bac954101f7a127fe8ef56e4e6 (diff) |
Revert "update_payload: Add XZ compression support"
This reverts commit f1d6ceaedbcf81044d6af6b716c63ed79996f0a4.
Reason for revert: <canaries failing>
Original change's description:
> update_payload: Add XZ compression support
>
> This patch adds support for checking a payload that has REPLACE_XZ
> operations. REPLACE_XZ was added in minor version 3.
>
> BUG=chromium:758792
> TEST=unittests pass; paycheck.py with a xz generated payload pass;
> CQ-DEPEND=CL:823234
>
> Change-Id: If82c767a201b189e464f459d5c19485e5278d9b1
> Reviewed-on: https://chromium-review.googlesource.com/823227
> Commit-Ready: Amin Hassani <ahassani@chromium.org>
> Tested-by: Amin Hassani <ahassani@chromium.org>
> Reviewed-by: Ben Chan <benchan@chromium.org>
> Reviewed-by: Sen Jiang <senj@chromium.org>
TBR=benchan@chromium.org,senj@chromium.org,ahassani@chromium.org
Change-Id: I931ff3be081a41fe5fceef0e049ba4165c6acb49
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:795313
Reviewed-on: https://chromium-review.googlesource.com/830054
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Diffstat (limited to 'scripts/update_payload/checker_unittest.py')
-rwxr-xr-x | scripts/update_payload/checker_unittest.py | 59 |
1 files changed, 8 insertions, 51 deletions
diff --git a/scripts/update_payload/checker_unittest.py b/scripts/update_payload/checker_unittest.py index a38e334a..245da55e 100755 --- a/scripts/update_payload/checker_unittest.py +++ b/scripts/update_payload/checker_unittest.py @@ -634,44 +634,6 @@ class PayloadCheckerTest(mox.MoxTestBase): payload_checker._CheckReplaceOperation, op, data_length, (data_length + block_size - 1) / block_size, 'foo') - def testCheckReplaceXzOperation(self): - """Tests _CheckReplaceOperation() where op.type == REPLACE_XZ.""" - payload_checker = checker.PayloadChecker(self.MockPayload()) - block_size = payload_checker.block_size - data_length = block_size * 3 - - op = self.mox.CreateMock( - update_metadata_pb2.InstallOperation) - op.type = common.OpType.REPLACE_XZ - - # Pass. - op.src_extents = [] - self.assertIsNone( - payload_checker._CheckReplaceOperation( - op, data_length, (data_length + block_size - 1) / block_size + 5, - 'foo')) - - # Fail, src extents founds. - op.src_extents = ['bar'] - self.assertRaises( - update_payload.PayloadError, - payload_checker._CheckReplaceOperation, - op, data_length, (data_length + block_size - 1) / block_size + 5, 'foo') - - # Fail, missing data. - op.src_extents = [] - self.assertRaises( - update_payload.PayloadError, - payload_checker._CheckReplaceOperation, - op, None, (data_length + block_size - 1) / block_size, 'foo') - - # Fail, too few blocks to justify XZ. - op.src_extents = [] - self.assertRaises( - update_payload.PayloadError, - payload_checker._CheckReplaceOperation, - op, data_length, (data_length + block_size - 1) / block_size, 'foo') - def testCheckMoveOperation_Pass(self): """Tests _CheckMoveOperation(); pass case.""" payload_checker = checker.PayloadChecker(self.MockPayload()) @@ -857,8 +819,8 @@ class PayloadCheckerTest(mox.MoxTestBase): """Parametric testing of _CheckOperation(). Args: - op_type_name: 'REPLACE', 'REPLACE_BZ', 'REPLACE_XZ', 'MOVE', 'BSDIFF', - 'SOURCE_COPY', 'SOURCE_BSDIFF', BROTLI_BSDIFF or 'PUFFDIFF'. + op_type_name: 'REPLACE', 'REPLACE_BZ', 'MOVE', 'BSDIFF', 'SOURCE_COPY', + 'SOURCE_BSDIFF', BROTLI_BSDIFF or 'PUFFDIFF'. is_last: Whether we're testing the last operation in a sequence. allow_signature: Whether we're testing a signature-capable operation. allow_unhashed: Whether we're allowing to not hash the data. @@ -913,8 +875,6 @@ class PayloadCheckerTest(mox.MoxTestBase): payload_checker.minor_version = 2 if fail_bad_minor_version else 1 elif op_type in (common.OpType.SOURCE_COPY, common.OpType.SOURCE_BSDIFF): payload_checker.minor_version = 1 if fail_bad_minor_version else 2 - if op_type == common.OpType.REPLACE_XZ: - payload_checker.minor_version = 2 if fail_bad_minor_version else 3 elif op_type in (common.OpType.ZERO, common.OpType.DISCARD, common.OpType.PUFFDIFF, common.OpType.BROTLI_BSDIFF): payload_checker.minor_version = 3 if fail_bad_minor_version else 4 @@ -1235,13 +1195,10 @@ def ValidateCheckOperationTest(op_type_name, is_last, allow_signature, """Returns True iff the combination of arguments represents a valid test.""" op_type = _OpTypeByName(op_type_name) - # REPLACE/REPLACE_BZ/REPLACE_XZ operations don't read data from src - # partition. They are compatible with all valid minor versions, so we don't - # need to check that. - if (op_type in (common.OpType.REPLACE, common.OpType.REPLACE_BZ, - common.OpType.REPLACE_XZ) and (fail_src_extents or - fail_src_length or - fail_bad_minor_version)): + # REPLACE/REPLACE_BZ operations don't read data from src partition. They are + # compatible with all valid minor versions, so we don't need to check that. + if (op_type in (common.OpType.REPLACE, common.OpType.REPLACE_BZ) and ( + fail_src_extents or fail_src_length or fail_bad_minor_version)): return False # MOVE and SOURCE_COPY operations don't carry data. @@ -1327,8 +1284,8 @@ def AddAllParametricTests(): # Add all _CheckOperation() test cases. AddParametricTests('CheckOperation', - {'op_type_name': ('REPLACE', 'REPLACE_BZ', 'REPLACE_XZ', - 'MOVE', 'BSDIFF', 'SOURCE_COPY', + {'op_type_name': ('REPLACE', 'REPLACE_BZ', 'MOVE', + 'BSDIFF', 'SOURCE_COPY', 'SOURCE_BSDIFF', 'PUFFDIFF', 'BROTLI_BSDIFF'), 'is_last': (True, False), |