| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 rc = 0 | 85 rc = 0 |
| 86 try: | 86 try: |
| 87 executable = rest_args[0] | 87 executable = rest_args[0] |
| 88 extra_flags = [] | 88 extra_flags = [] |
| 89 if len(rest_args) > 1: | 89 if len(rest_args) > 1: |
| 90 extra_flags = rest_args[1:] | 90 extra_flags = rest_args[1:] |
| 91 |
| 92 # These flags are to make sure that test output perf metrics in the log. |
| 93 if not '--verbose' in extra_flags: |
| 94 extra_flags.append('--verbose') |
| 95 if not '--test-launcher-print-test-stdio=always' in extra_flags: |
| 96 extra_flags.append('--test-launcher-print-test-stdio=always') |
| 97 |
| 91 if IsWindows(): | 98 if IsWindows(): |
| 92 executable = '.\%s.exe' % executable | 99 executable = '.\%s.exe' % executable |
| 93 else: | 100 else: |
| 94 executable = './%s' % executable | 101 executable = './%s' % executable |
| 95 with common.temporary_file() as tempfile_path: | 102 with common.temporary_file() as tempfile_path: |
| 96 rc = common.run_command_with_output([executable] + extra_flags, | 103 rc = common.run_command_with_output([executable] + extra_flags, |
| 97 env=env, stdoutfile=tempfile_path) | 104 env=env, stdoutfile=tempfile_path) |
| 98 with open(tempfile_path) as f: | 105 with open(tempfile_path) as f: |
| 99 print f.read() | 106 print f.read() |
| 100 | 107 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if __name__ == '__main__': | 142 if __name__ == '__main__': |
| 136 # Conform minimally to the protocol defined by ScriptTest. | 143 # Conform minimally to the protocol defined by ScriptTest. |
| 137 if 'compile_targets' in sys.argv: | 144 if 'compile_targets' in sys.argv: |
| 138 funcs = { | 145 funcs = { |
| 139 'run': None, | 146 'run': None, |
| 140 'compile_targets': main_compile_targets, | 147 'compile_targets': main_compile_targets, |
| 141 } | 148 } |
| 142 sys.exit(common.run_script(sys.argv[1:], funcs)) | 149 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| 143 sys.exit(main()) | 150 sys.exit(main()) |
| 144 | 151 |
| OLD | NEW |