OLD | NEW |
---|---|
1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Set up and invoke telemetry tests.""" | 6 """Set up and invoke telemetry tests.""" |
7 | 7 |
8 import json | 8 import json |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
11 import sys | 11 import sys |
12 | 12 |
13 from common import chromium_utils | 13 from common import chromium_utils |
14 | 14 |
15 | 15 |
16 SCRIPT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | 16 SCRIPT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) |
17 | 17 |
18 | 18 |
19 def _GetPythonTestCommand(py_script, target, build_dir, arg_list=None, | 19 def _GetPythonTestCommand(py_script, target, build_dir, arg_list=None, |
20 wrapper_args=None, fp=None): | 20 wrapper_args=None, fp=None): |
21 """Synthesizes a command line to run runtest.py.""" | 21 """Synthesizes a command line to run runtest.py.""" |
22 cmd = [sys.executable, | 22 cmd = [sys.executable, |
23 os.path.join(SCRIPT_DIR, 'slave', 'runtest.py'), | 23 os.path.join(SCRIPT_DIR, 'slave', 'runtest.py'), |
24 '--run-python-script', | 24 '--run-python-script', |
25 '--target', target, | 25 '--target', target, |
26 '--build-dir', build_dir, | 26 '--build-dir', build_dir, |
27 '--no-xvfb'] # telemetry.py should be run by a 'master' runtest.py | 27 '--no-xvfb'] # telemetry.py should be run by a 'master' runtest.py |
28 # which starts xvfb on linux. | 28 # which starts xvfb on linux. |
29 if fp: | 29 if fp: |
30 cmd.extend(["--factory-properties=%s" % json.dumps(fp)]) | 30 cmd.extend(["--factory-properties=%s" % json.dumps(fp)]) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 # List of command line arguments common to all test platforms. | 74 # List of command line arguments common to all test platforms. |
75 common_args = ['-v', '--output-format=buildbot'] | 75 common_args = ['-v', '--output-format=buildbot'] |
76 if extra_args: | 76 if extra_args: |
77 common_args.extend(extra_args) | 77 common_args.extend(extra_args) |
78 | 78 |
79 # On android, telemetry needs to use the adb command and needs to be in | 79 # On android, telemetry needs to use the adb command and needs to be in |
80 # root mode. Run it in bash since envsetup.sh doesn't work in sh. | 80 # root mode. Run it in bash since envsetup.sh doesn't work in sh. |
81 if target_os == 'android': | 81 if target_os == 'android': |
82 env['PATH'] = os.pathsep.join(['/b/build_internal/scripts/slave/android', | 82 env['PATH'] = os.pathsep.join(['/b/build_internal/scripts/slave/android', |
83 env['PATH']]) | 83 env['PATH']]) |
84 commands = [['adb', 'root'], ['adb', 'wait-for-device']] | 84 commands = [['adb', 'root'], ['adb', 'wait-for-device']] |
ghost stip (do not use)
2013/11/11 22:29:11
do we need to have lines 81-86 here since we're no
bulach
2013/11/12 14:00:34
oh, good point! done.
| |
85 else: | 85 else: |
86 commands = [] | 86 commands = [] |
87 | 87 |
88 # Run the test against the target chrome build. | 88 # Run the test against the target chrome build. |
89 browser = target.lower() | 89 browser = target.lower() |
90 wrapper_args = None | |
90 if target_os == 'android': | 91 if target_os == 'android': |
91 browser = options.target_android_browser | 92 browser = options.target_android_browser |
93 wrapper_args = ['src/build/android/test_runner.py', 'perf', '-vvv', | |
frankf
2013/11/11 22:01:53
nit: Do you really want to log at DEBUG level? We
| |
94 '--single-step'] | |
92 # If an executable is passed, use that instead. | 95 # If an executable is passed, use that instead. |
93 if browser_exe: | 96 if browser_exe: |
94 browser_info = ['--browser=exact', | 97 browser_info = ['--browser=exact', |
95 '--browser-executable=%s' % browser_exe] | 98 '--browser-executable=%s' % browser_exe] |
96 else: | 99 else: |
97 browser_info = ['--browser=%s' % browser] | 100 browser_info = ['--browser=%s' % browser] |
98 test_args = list(common_args) | 101 test_args = list(common_args) |
99 test_args.extend(browser_info) | 102 test_args.extend(browser_info) |
100 test_args.extend(test_specification) | 103 test_args.extend(test_specification) |
101 test_cmd = _GetPythonTestCommand(script, target, build_dir, test_args, fp=fp) | 104 test_cmd = _GetPythonTestCommand(script, target, build_dir, test_args, |
105 wrapper_args=wrapper_args, fp=fp) | |
102 commands.append(test_cmd) | 106 commands.append(test_cmd) |
103 | 107 |
104 # Run the test against the target chrome build for different user profiles on | 108 # Run the test against the target chrome build for different user profiles on |
105 # certain page cyclers. | 109 # certain page cyclers. |
106 if target_os != 'android': | 110 if target_os != 'android': |
107 if test_name in ('page_cycler_moz', 'page_cycler_morejs'): | 111 if test_name in ('page_cycler_moz', 'page_cycler_morejs'): |
108 test_args = list(common_args) | 112 test_args = list(common_args) |
109 test_args.extend(['--profile-type=typical_user', | 113 test_args.extend(['--profile-type=typical_user', |
110 '--output-trace-tag=_extcs1']) | 114 '--output-trace-tag=_extcs1']) |
111 test_args.extend(browser_info) | 115 test_args.extend(browser_info) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 continue | 168 continue |
165 | 169 |
166 retval = chromium_utils.RunCommand(command, env=env) | 170 retval = chromium_utils.RunCommand(command, env=env) |
167 if retval != 0: | 171 if retval != 0: |
168 break | 172 break |
169 return retval | 173 return retval |
170 | 174 |
171 | 175 |
172 if '__main__' == __name__: | 176 if '__main__' == __name__: |
173 sys.exit(main(sys.argv)) | 177 sys.exit(main(sys.argv)) |
OLD | NEW |