From 276f06275b3c93bbebf787bb6ffb28fce9ee3fee Mon Sep 17 00:00:00 2001 From: Daniel Norman Date: Fri, 26 Jul 2019 14:13:51 -0700 Subject: Adds support for optionally generating vbmeta.img in merge_builds. Bug: 137853921 Bug: 138671115 Test: python -m unittest test_common Test: python -m unittest test_add_img_to_target_files Test: Ran 'merge_builds --build_vbmeta' for two devices, one with the vbmeta struct on system.img and another with vbmeta_system.img. Flashed the regenerated vbmeta.img files on devices, devices boot. Change-Id: I8d7585c7af468be3d242d8aceeed6d27e6fc6d96 --- tools/releasetools/test_common.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tools/releasetools/test_common.py') diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py index bcfb1c104a..ceb023f793 100644 --- a/tools/releasetools/test_common.py +++ b/tools/releasetools/test_common.py @@ -1137,6 +1137,30 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase): } self.assertEqual(merged_dict, expected_merged_dict) + def test_GetAvbPartitionArg(self): + info_dict = {} + cmd = common.GetAvbPartitionArg('system', '/path/to/system.img', info_dict) + self.assertEqual( + ['--include_descriptors_from_image', '/path/to/system.img'], cmd) + + @test_utils.SkipIfExternalToolsUnavailable() + def test_AppendVBMetaArgsForPartition_vendorAsChainedPartition(self): + testdata_dir = test_utils.get_testdata_dir() + pubkey = os.path.join(testdata_dir, 'testkey.pubkey.pem') + info_dict = { + 'avb_avbtool': 'avbtool', + 'avb_vendor_key_path': pubkey, + 'avb_vendor_rollback_index_location': 5, + } + cmd = common.GetAvbPartitionArg('vendor', '/path/to/vendor.img', info_dict) + self.assertEqual(2, len(cmd)) + self.assertEqual('--chain_partition', cmd[0]) + chained_partition_args = cmd[1].split(':') + self.assertEqual(3, len(chained_partition_args)) + self.assertEqual('vendor', chained_partition_args[0]) + self.assertEqual('5', chained_partition_args[1]) + self.assertTrue(os.path.exists(chained_partition_args[2])) + class InstallRecoveryScriptFormatTest(test_utils.ReleaseToolsTestCase): """Checks the format of install-recovery.sh. -- cgit v1.2.3-59-g8ed1b