Skip to content

Commit

Permalink
Updating benchmark script to only write chartjson when flag present.
Browse files Browse the repository at this point in the history
BUG=chromium:633253

Review-Url: https://codereview.chromium.org/2366673002
Cr-Commit-Position: refs/heads/master@{#420675}
  • Loading branch information
eyaich authored and Commit bot committed Sep 23, 2016
1 parent 6926d67 commit da48d3a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions testing/scripts/run_telemetry_benchmark_as_googletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def main():
'--isolated-script-test-output', type=argparse.FileType('w'),
required=True)
parser.add_argument(
'--isolated-script-test-chartjson-output', type=argparse.FileType('w'),
required=False)
'--isolated-script-test-chartjson-output', required=False)
parser.add_argument('--xvfb', help='Start xvfb.', action='store_true')
args, rest_args = parser.parse_known_args()
xvfb_proc = None
Expand All @@ -65,8 +64,7 @@ def main():
tempfile_dir = tempfile.mkdtemp('telemetry')
valid = True
failures = []
chartjson = (args.isolated_script_test_chartjson_output is not None and
'--output-format=chartjson' in rest_args)
chartjson_results_present = '--output-format=chartjson' in rest_args
chartresults = None
try:
rc = common.run_command([sys.executable] + rest_args + [
Expand All @@ -83,7 +81,7 @@ def main():
# If we have also output chartjson read it in and return it.
# results-chart.json is the file name output by telemetry when the
# chartjson output format is included
if chartjson:
if chartjson_results_present:
chart_tempfile_name = os.path.join(tempfile_dir, 'results-chart.json')
with open(chart_tempfile_name) as f:
chartresults = json.load(f)
Expand All @@ -98,8 +96,10 @@ def main():
if rc == 0:
rc = 1 # Signal an abnormal exit.

if chartjson:
json.dump(chartresults, args.isolated_script_test_chartjson_output)
if chartjson_results_present and args.isolated_script_test_chartjson_output:
chartjson_output_file = \
open(args.isolated_script_test_chartjson_output, 'w')
json.dump(chartresults, chartjson_output_file)

json.dump({
'valid': valid,
Expand Down

0 comments on commit da48d3a

Please sign in to comment.