diff options
| author | 2021-10-27 03:53:21 +0900 | |
|---|---|---|
| committer | 2021-10-27 16:56:22 +0900 | |
| commit | 0f5a41da56c51be5d2e14926ddbbc323ec2f6c9f (patch) | |
| tree | 20c90c687d136e880c3037110f0de46c4cc63664 /tools/releasetools/test_apex_utils.py | |
| parent | c4b7b34b4b7d8e1f88dd21d2495206e437caa025 (diff) | |
sign_apex --sign_tool
A new argument is a custom signing tool for APEX contents. When
specified, apex_util invokes the tool with payload's key and payload
directory.
For now, the Virt APEX has its own custom signing tool (sign_virt_apex)
to re-sign filesystem images in it.
Bug: 193504286
Test: atest releasetools_test
Test: m sign_apex sign_virt_apex
Test: sign_apex --sign_tool sign_virt_apex --payload_key ..
--container_key .. resigned.apex
adb install resigned.apex
reboot & vm run-app
Change-Id: Ic4d369c2ba42a8295044a0a75e054dc8def93208
Diffstat (limited to 'tools/releasetools/test_apex_utils.py')
| -rw-r--r-- | tools/releasetools/test_apex_utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/releasetools/test_apex_utils.py b/tools/releasetools/test_apex_utils.py index 71f643378d..ed920f28d7 100644 --- a/tools/releasetools/test_apex_utils.py +++ b/tools/releasetools/test_apex_utils.py @@ -187,3 +187,19 @@ class ApexUtilsTest(test_utils.ReleaseToolsTestCase): self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key') signer.ProcessApexFile(apk_keys, self.payload_key) + + @test_utils.SkipIfExternalToolsUnavailable() + def test_ApexApkSigner_invokesCustomSignTool(self): + apex_path = common.MakeTempFile(suffix='.apex') + shutil.copy(self.apex_with_apk, apex_path) + apk_keys = {'wifi-service-resources.apk': os.path.join( + self.testdata_dir, 'testkey')} + self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key') + + # pass `false` as a sign_tool to see the invocation error + with self.assertRaises(common.ExternalError) as cm: + signer = apex_utils.ApexApkSigner(apex_path, None, None, sign_tool='false') + signer.ProcessApexFile(apk_keys, self.payload_key) + + the_exception = cm.exception + self.assertIn('Failed to run command \'[\'false\'', the_exception.message) |