OLD | NEW |
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if args.xvfb and xvfb.should_start_xvfb(env): | 79 if args.xvfb and xvfb.should_start_xvfb(env): |
80 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env, | 80 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env, |
81 build_dir='.') | 81 build_dir='.') |
82 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb' | 82 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb' |
83 | 83 |
84 try: | 84 try: |
85 valid = True | 85 valid = True |
86 rc = 0 | 86 rc = 0 |
87 try: | 87 try: |
88 executable = rest_args[0] | 88 executable = rest_args[0] |
| 89 extra_flags = [] |
| 90 if len(rest_args) > 1: |
| 91 extra_flags = rest_args[1:] |
89 if IsWindows(): | 92 if IsWindows(): |
90 executable = '.\%s.exe' % executable | 93 executable = '.\%s.exe' % executable |
91 else: | 94 else: |
92 executable = './%s' % executable | 95 executable = './%s' % executable |
93 with common.temporary_file() as tempfile_path: | 96 with common.temporary_file() as tempfile_path: |
94 valid = (common.run_command_with_output([executable], | 97 valid = (common.run_command_with_output([executable] + extra_flags, |
95 env=env, stdoutfile=tempfile_path) == 0) | 98 env=env, stdoutfile=tempfile_path) == 0) |
96 | 99 |
97 # Now get the correct json format from the stdout to write to the | 100 # Now get the correct json format from the stdout to write to the |
98 # perf results file | 101 # perf results file |
99 results_processor = ( | 102 results_processor = ( |
100 generate_legacy_perf_dashboard_json.LegacyResultsProcessor()) | 103 generate_legacy_perf_dashboard_json.LegacyResultsProcessor()) |
101 charts = results_processor.GenerateJsonResults(tempfile_path) | 104 charts = results_processor.GenerateJsonResults(tempfile_path) |
102 # Write the returned encoded json to a the charts output file | 105 # Write the returned encoded json to a the charts output file |
103 with open(args.isolated_script_test_chartjson_output, 'w') as f: | 106 with open(args.isolated_script_test_chartjson_output, 'w') as f: |
104 f.write(charts) | 107 f.write(charts) |
(...skipping 25 matching lines...) Expand all Loading... |
130 if __name__ == '__main__': | 133 if __name__ == '__main__': |
131 # Conform minimally to the protocol defined by ScriptTest. | 134 # Conform minimally to the protocol defined by ScriptTest. |
132 if 'compile_targets' in sys.argv: | 135 if 'compile_targets' in sys.argv: |
133 funcs = { | 136 funcs = { |
134 'run': None, | 137 'run': None, |
135 'compile_targets': main_compile_targets, | 138 'compile_targets': main_compile_targets, |
136 } | 139 } |
137 sys.exit(common.run_script(sys.argv[1:], funcs)) | 140 sys.exit(common.run_script(sys.argv[1:], funcs)) |
138 sys.exit(main()) | 141 sys.exit(main()) |
139 | 142 |
OLD | NEW |