Commit 39500d22 authored by John Budorick's avatar John Budorick Committed by Commit Bot

android: revise output when passing --isolated-script-test-output

This should make resource_sizes output files in a format and structure
amenable to process_perf_results.

Bug: 807273,861983
Change-Id: I5d359b35ad4ba836cd1282f804daf996fbbec7e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1574455
Commit-Queue: John Budorick <jbudorick@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Auto-Submit: John Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarBen Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652688}
parent a8cd9fd1
......@@ -30,7 +30,8 @@ template("android_resource_sizes_test") {
_apk_path =
"@WrappedPath(@FileArg($_rebased_apk_build_config:deps_info:apk_path))"
executable_args = [
"--chartjson",
"--output-format",
"histograms",
_apk_path,
"--chromium-output-directory",
"@WrappedPath(.)",
......
......@@ -712,8 +712,6 @@ def main():
choices=['chartjson', 'histograms'],
help='Output the results to a file in the given '
'format instead of printing the results.')
argparser.add_argument(
'--output-dir', default='.', help='Directory to save chartjson to.')
argparser.add_argument('--loadable_module', help='Obsolete (ignored).')
argparser.add_argument(
'--estimate-patch-size',
......@@ -739,7 +737,11 @@ def main():
type=os.path.realpath,
help=argparse.SUPPRESS)
argparser.add_argument(
output_group = argparser.add_mutually_exclusive_group()
output_group.add_argument(
'--output-dir', default='.', help='Directory to save chartjson to.')
output_group.add_argument(
'--isolated-script-test-output',
type=os.path.realpath,
help='File to which results will be written in the '
......@@ -756,6 +758,12 @@ def main():
isolated_script_output = {'valid': False, 'failures': []}
if args.isolated_script_test_output:
args.output_dir = os.path.join(
os.path.dirname(args.isolated_script_test_output), 'resource_sizes')
if not os.path.exists(args.output_dir):
os.makedirs(args.output_dir)
try:
result = ResourceSizes(args)
isolated_script_output = {
......@@ -764,6 +772,9 @@ def main():
}
finally:
if args.isolated_script_test_output:
results_path = os.path.join(args.output_dir, 'test_results.json')
with open(results_path, 'w') as output_file:
json.dump(isolated_script_output, output_file)
with open(args.isolated_script_test_output, 'w') as output_file:
json.dump(isolated_script_output, output_file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment