releasetools: Set default stdout and stderr in common.Run().

stdout and stderr will default to subprocess.PIPE and subprocess.STDOUT
respectively (which is the expected behavior from most of the existing
callers), unless caller specifies any of them.

Test: `m dist`
Test: python -m unittest \
          test_common \
          test_add_img_to_target_files \
          test_ota_from_target_files \
          test_validate_target_files
Change-Id: I43b3f08edfa8a9bcfe54baf9848dc705c048e327
This commit is contained in:
Tao Bao
2018-10-04 16:25:33 -07:00
parent d1428e2748
commit 73dd4f45f3
9 changed files with 89 additions and 85 deletions

View File

@@ -35,7 +35,6 @@ import filecmp
import logging
import os.path
import re
import subprocess
import zipfile
import common
@@ -256,7 +255,7 @@ def ValidateVerifiedBootImages(input_tmp, info_dict, options):
continue
cmd = ['boot_signer', '-verify', image_path, '-certificate', verity_key]
proc = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
proc = common.Run(cmd)
stdoutdata, _ = proc.communicate()
assert proc.returncode == 0, \
'Failed to verify {} with boot_signer:\n{}'.format(image, stdoutdata)
@@ -299,7 +298,7 @@ def ValidateVerifiedBootImages(input_tmp, info_dict, options):
continue
cmd = ['verity_verifier', image_path, '-mincrypt', verity_key_mincrypt]
proc = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
proc = common.Run(cmd)
stdoutdata, _ = proc.communicate()
assert proc.returncode == 0, \
'Failed to verify {} with verity_verifier (key: {}):\n{}'.format(
@@ -328,7 +327,7 @@ def ValidateVerifiedBootImages(input_tmp, info_dict, options):
partition, info_dict, options[key_name])
cmd.extend(["--expected_chain_partition", chained_partition_arg])
proc = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
proc = common.Run(cmd)
stdoutdata, _ = proc.communicate()
assert proc.returncode == 0, \
'Failed to verify {} with verity_verifier (key: {}):\n{}'.format(