Chromium Code Reviews| Index: content/test/gpu/run_gpu_integration_test.py |
| diff --git a/content/test/gpu/run_gpu_integration_test.py b/content/test/gpu/run_gpu_integration_test.py |
| index 16deb3aef05a349d991e865b92729043670239f9..dc270b912cf7e6234abf56e178aec57f214d751a 100755 |
| --- a/content/test/gpu/run_gpu_integration_test.py |
| +++ b/content/test/gpu/run_gpu_integration_test.py |
| @@ -5,6 +5,7 @@ |
| import argparse |
| import json |
| +import os |
| import sys |
| from gpu_tests import path_util |
| @@ -15,31 +16,29 @@ path_util.SetupTelemetryPaths() |
| from telemetry.testing import browser_test_runner |
| def PostprocessJSON(file_name, run_test_args): |
| - def TrimPrefix(s): |
| - return s[1 + s.rfind('.'):] |
| - with open(file_name) as f: |
| - test_result = json.load(f) |
| - test_result['successes'] = map(TrimPrefix, test_result['successes']) |
| - test_result['failures'] = map(TrimPrefix, test_result['failures']) |
| - test_result['run_test_args'] = run_test_args |
| - with open(file_name, 'w') as f: |
| - json.dump(test_result, f) |
| + # The file is not necessarily written depending on the arguments - only |
| + # postprocess it in case it is. |
| + if os.path.isfile(file_name): |
| + with open(file_name) as f: |
| + test_result = json.load(f) |
| + test_result['run_test_args'] = run_test_args |
|
Ken Russell (switch to Gerrit)
2017/03/14 04:42:16
Sorry, I should have guessed that this would not w
|
| + with open(file_name, 'w') as f: |
| + json.dump(test_result, f, indent=2) |
| def main(): |
| rest_args = sys.argv[1:] |
| retval = browser_test_runner.Run( |
| gpu_project_config.CONFIG, rest_args) |
| - # Postprocess the outputted JSON to trim all of the prefixes from |
| - # the test names, to keep them as similar to the old form as |
| - # possible -- and keep them from getting crazily long. |
| - parser = argparse.ArgumentParser(description='Temporary argument parser') |
| + # Postprocess the outputted JSON to add test arguments. |
| + parser = argparse.ArgumentParser(description='Temporary argument parser', |
| + add_help=False) |
| parser.add_argument( |
| - '--write-abbreviated-json-results-to', metavar='FILENAME', |
| + '--write-full-results-to', metavar='FILENAME', |
| action='store', |
| - help=('Full path for json results')) |
| + help=('If specified, writes the full results to that path')) |
| option, _ = parser.parse_known_args(rest_args) |
| - if option.write_abbreviated_json_results_to: |
| - PostprocessJSON(option.write_abbreviated_json_results_to, rest_args) |
| + if option.write_full_results_to: |
| + PostprocessJSON(option.write_full_results_to, rest_args) |
| return retval |
| if __name__ == '__main__': |