Use common.RunAndCheckOutput() in add_img_to_target_files.py.
Test: `m dist` with aosp_marlin-userdebug Test: python -m unittest test_add_img_to_target_files.py Change-Id: Icff60a44e5c189c2443fbaba3fc6a2b106b409ea
This commit is contained in:
@@ -260,11 +260,7 @@ def AddDtbo(output_zip):
|
|||||||
args = OPTIONS.info_dict.get("avb_dtbo_add_hash_footer_args")
|
args = OPTIONS.info_dict.get("avb_dtbo_add_hash_footer_args")
|
||||||
if args and args.strip():
|
if args and args.strip():
|
||||||
cmd.extend(shlex.split(args))
|
cmd.extend(shlex.split(args))
|
||||||
proc = common.Run(cmd)
|
common.RunAndCheckOutput(cmd)
|
||||||
output, _ = proc.communicate()
|
|
||||||
assert proc.returncode == 0, \
|
|
||||||
"Failed to call 'avbtool add_hash_footer' for {}:\n{}".format(
|
|
||||||
img.name, output)
|
|
||||||
|
|
||||||
img.Write()
|
img.Write()
|
||||||
return img.name
|
return img.name
|
||||||
@@ -331,8 +327,8 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
|
|||||||
info_dict[image_blocks_key] = int(image_size) / 4096 - 1
|
info_dict[image_blocks_key] = int(image_size) / 4096 - 1
|
||||||
|
|
||||||
use_dynamic_size = (
|
use_dynamic_size = (
|
||||||
info_dict.get("use_dynamic_partition_size") == "true" and
|
info_dict.get("use_dynamic_partition_size") == "true" and
|
||||||
what in shlex.split(info_dict.get("dynamic_partition_list", "").strip()))
|
what in shlex.split(info_dict.get("dynamic_partition_list", "").strip()))
|
||||||
if use_dynamic_size:
|
if use_dynamic_size:
|
||||||
info_dict.update(build_image.GlobalDictFromImageProp(image_props, what))
|
info_dict.update(build_image.GlobalDictFromImageProp(image_props, what))
|
||||||
|
|
||||||
@@ -463,10 +459,7 @@ def AddVBMeta(output_zip, partitions, name, needed_partitions):
|
|||||||
assert found, 'Failed to find {}'.format(image_path)
|
assert found, 'Failed to find {}'.format(image_path)
|
||||||
cmd.extend(split_args)
|
cmd.extend(split_args)
|
||||||
|
|
||||||
proc = common.Run(cmd)
|
common.RunAndCheckOutput(cmd)
|
||||||
stdoutdata, _ = proc.communicate()
|
|
||||||
assert proc.returncode == 0, \
|
|
||||||
"avbtool make_vbmeta_image failed:\n{}".format(stdoutdata)
|
|
||||||
img.Write()
|
img.Write()
|
||||||
return img.name
|
return img.name
|
||||||
|
|
||||||
@@ -493,11 +486,7 @@ def AddPartitionTable(output_zip):
|
|||||||
args = OPTIONS.info_dict.get("board_bpt_make_table_args")
|
args = OPTIONS.info_dict.get("board_bpt_make_table_args")
|
||||||
if args:
|
if args:
|
||||||
cmd.extend(shlex.split(args))
|
cmd.extend(shlex.split(args))
|
||||||
|
common.RunAndCheckOutput(cmd)
|
||||||
proc = common.Run(cmd)
|
|
||||||
stdoutdata, _ = proc.communicate()
|
|
||||||
assert proc.returncode == 0, \
|
|
||||||
"bpttool make_table failed:\n{}".format(stdoutdata)
|
|
||||||
|
|
||||||
img.Write()
|
img.Write()
|
||||||
bpt.Write()
|
bpt.Write()
|
||||||
@@ -612,10 +601,7 @@ def AddCareMapForAbOta(output_zip, ab_partitions, image_paths):
|
|||||||
|
|
||||||
temp_care_map = common.MakeTempFile(prefix="caremap-", suffix=".pb")
|
temp_care_map = common.MakeTempFile(prefix="caremap-", suffix=".pb")
|
||||||
care_map_gen_cmd = ["care_map_generator", temp_care_map_text, temp_care_map]
|
care_map_gen_cmd = ["care_map_generator", temp_care_map_text, temp_care_map]
|
||||||
proc = common.Run(care_map_gen_cmd)
|
common.RunAndCheckOutput(care_map_gen_cmd)
|
||||||
output, _ = proc.communicate()
|
|
||||||
assert proc.returncode == 0, \
|
|
||||||
"Failed to generate the care_map proto message:\n{}".format(output)
|
|
||||||
|
|
||||||
care_map_path = "META/care_map.pb"
|
care_map_path = "META/care_map.pb"
|
||||||
if output_zip and care_map_path not in output_zip.namelist():
|
if output_zip and care_map_path not in output_zip.namelist():
|
||||||
@@ -665,11 +651,7 @@ def AddSuperEmpty(output_zip):
|
|||||||
cmd = [OPTIONS.info_dict['lpmake']]
|
cmd = [OPTIONS.info_dict['lpmake']]
|
||||||
cmd += shlex.split(OPTIONS.info_dict['lpmake_args'].strip())
|
cmd += shlex.split(OPTIONS.info_dict['lpmake_args'].strip())
|
||||||
cmd += ['--output', img.name]
|
cmd += ['--output', img.name]
|
||||||
|
common.RunAndCheckOutput(cmd)
|
||||||
proc = common.Run(cmd)
|
|
||||||
stdoutdata, _ = proc.communicate()
|
|
||||||
assert proc.returncode == 0, \
|
|
||||||
"lpmake tool failed:\n{}".format(stdoutdata)
|
|
||||||
|
|
||||||
img.Write()
|
img.Write()
|
||||||
|
|
||||||
@@ -715,10 +697,7 @@ def AddSuperSplit(output_zip):
|
|||||||
|
|
||||||
cmd += ['--output', outdir.name]
|
cmd += ['--output', outdir.name]
|
||||||
|
|
||||||
proc = common.Run(cmd)
|
common.RunAndCheckOutput(cmd)
|
||||||
stdoutdata, _ = proc.communicate()
|
|
||||||
assert proc.returncode == 0, \
|
|
||||||
"lpmake tool failed:\n{}".format(stdoutdata)
|
|
||||||
|
|
||||||
for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
|
for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
|
||||||
img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
|
img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
|
||||||
|
@@ -40,11 +40,7 @@ class AddImagesToTargetFilesTest(test_utils.ReleaseToolsTestCase):
|
|||||||
|
|
||||||
# Calls an external binary to convert the proto message.
|
# Calls an external binary to convert the proto message.
|
||||||
cmd = ["care_map_generator", "--parse_proto", file_name, text_file]
|
cmd = ["care_map_generator", "--parse_proto", file_name, text_file]
|
||||||
proc = common.Run(cmd)
|
common.RunAndCheckOutput(cmd)
|
||||||
output, _ = proc.communicate()
|
|
||||||
self.assertEqual(
|
|
||||||
0, proc.returncode,
|
|
||||||
"Failed to run care_map_generator:\n{}".format(output))
|
|
||||||
|
|
||||||
with open(text_file, 'r') as verify_fp:
|
with open(text_file, 'r') as verify_fp:
|
||||||
plain_text = verify_fp.read()
|
plain_text = verify_fp.read()
|
||||||
|
Reference in New Issue
Block a user