Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Side by Side Diff: testing/scripts/run_gtest_perf_test.py

Issue 2889153007: Update run_gtest_perf_test.py to streaming command output to stdout & log file at the same time (Closed)
Patch Set: Address Daniel's comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/scripts/common.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Runs an isolated non-Telemetry perf test . 6 """Runs an isolated non-Telemetry perf test .
7 7
8 The main contract is that the caller passes the arguments: 8 The main contract is that the caller passes the arguments:
9 9
10 --isolated-script-test-output=[FILENAME] 10 --isolated-script-test-output=[FILENAME]
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if not '--test-launcher-print-test-stdio=always' in extra_flags: 95 if not '--test-launcher-print-test-stdio=always' in extra_flags:
96 extra_flags.append('--test-launcher-print-test-stdio=always') 96 extra_flags.append('--test-launcher-print-test-stdio=always')
97 97
98 if IsWindows(): 98 if IsWindows():
99 executable = '.\%s.exe' % executable 99 executable = '.\%s.exe' % executable
100 else: 100 else:
101 executable = './%s' % executable 101 executable = './%s' % executable
102 with common.temporary_file() as tempfile_path: 102 with common.temporary_file() as tempfile_path:
103 rc = common.run_command_with_output([executable] + extra_flags, 103 rc = common.run_command_with_output([executable] + extra_flags,
104 env=env, stdoutfile=tempfile_path) 104 env=env, stdoutfile=tempfile_path)
105 with open(tempfile_path) as f:
106 print f.read()
107
108 # Now get the correct json format from the stdout to write to the 105 # Now get the correct json format from the stdout to write to the
109 # perf results file 106 # perf results file
110 results_processor = ( 107 results_processor = (
111 generate_legacy_perf_dashboard_json.LegacyResultsProcessor()) 108 generate_legacy_perf_dashboard_json.LegacyResultsProcessor())
112 charts = results_processor.GenerateJsonResults(tempfile_path) 109 charts = results_processor.GenerateJsonResults(tempfile_path)
113 # Write the returned encoded json to a the charts output file 110 # Write the returned encoded json to a the charts output file
114 with open(args.isolated_script_test_chartjson_output, 'w') as f: 111 with open(args.isolated_script_test_chartjson_output, 'w') as f:
115 f.write(charts) 112 f.write(charts)
116 except Exception: 113 except Exception:
117 traceback.print_exc() 114 traceback.print_exc()
(...skipping 24 matching lines...) Expand all
142 if __name__ == '__main__': 139 if __name__ == '__main__':
143 # Conform minimally to the protocol defined by ScriptTest. 140 # Conform minimally to the protocol defined by ScriptTest.
144 if 'compile_targets' in sys.argv: 141 if 'compile_targets' in sys.argv:
145 funcs = { 142 funcs = {
146 'run': None, 143 'run': None,
147 'compile_targets': main_compile_targets, 144 'compile_targets': main_compile_targets,
148 } 145 }
149 sys.exit(common.run_script(sys.argv[1:], funcs)) 146 sys.exit(common.run_script(sys.argv[1:], funcs))
150 sys.exit(main()) 147 sys.exit(main())
151 148
OLDNEW
« no previous file with comments | « testing/scripts/common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698