| Index: testing/scripts/run_telemetry_benchmark_as_googletest.py
|
| diff --git a/testing/scripts/run_telemetry_benchmark_as_googletest.py b/testing/scripts/run_telemetry_benchmark_as_googletest.py
|
| index 387c5c8da95993f984f20522253b471eca93a58d..dd8d23b69bd04a29ded9edbc6bbfbe53bea1b14f 100755
|
| --- a/testing/scripts/run_telemetry_benchmark_as_googletest.py
|
| +++ b/testing/scripts/run_telemetry_benchmark_as_googletest.py
|
| @@ -44,6 +44,9 @@ def main():
|
| parser.add_argument(
|
| '--isolated-script-test-output', type=argparse.FileType('w'),
|
| required=True)
|
| + parser.add_argument(
|
| + '--isolated-script-test-chartjson-output', type=argparse.FileType('w'),
|
| + required=False)
|
| parser.add_argument('--xvfb', help='Start xvfb.', action='store_true')
|
| args, rest_args = parser.parse_known_args()
|
| xvfb_proc = None
|
| @@ -62,6 +65,9 @@ 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)
|
| + chartresults = None
|
| try:
|
| rc = common.run_command([sys.executable] + rest_args + [
|
| '--output-dir', tempfile_dir,
|
| @@ -74,6 +80,13 @@ def main():
|
| if value['type'] == 'failure':
|
| failures.append(results['pages'][str(value['page_id'])]['name'])
|
| valid = bool(rc == 0 or failures)
|
| + # 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:
|
| + chart_tempfile_name = os.path.join(tempfile_dir, 'results-chart.json')
|
| + with open(chart_tempfile_name) as f:
|
| + chartresults = json.load(f)
|
| except Exception:
|
| traceback.print_exc()
|
| valid = False
|
| @@ -85,9 +98,12 @@ def main():
|
| if rc == 0:
|
| rc = 1 # Signal an abnormal exit.
|
|
|
| + if chartjson:
|
| + json.dump(chartresults, args.isolated_script_test_chartjson_output)
|
| +
|
| json.dump({
|
| 'valid': valid,
|
| - 'failures': failures,
|
| + 'failures': failures
|
| }, args.isolated_script_test_output)
|
| return rc
|
|
|
|
|