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 from slave import build_directory | 14 from slave import build_directory |
15 | 15 |
16 | 16 |
17 SCRIPT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | 17 SCRIPT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) |
18 | 18 |
19 | 19 |
20 def _GetPythonTestCommand(py_script, target, arg_list=None, | 20 def _GetPythonTestCommand(py_script, target, arg_list=None, |
21 wrapper_args=None, fp=None): | 21 wrapper_args=None, fp=None): |
22 """Synthesizes a command line to run runtest.py.""" | 22 """Synthesizes a command line to run runtest.py.""" |
23 cmd = [sys.executable, | 23 cmd = [sys.executable, |
24 os.path.join(SCRIPT_DIR, 'slave', 'runtest.py'), | 24 os.path.join(SCRIPT_DIR, 'slave', 'runtest.py'), |
25 '--run-python-script', | 25 '--run-python-script', |
26 '--target', target, | 26 '--target', target, |
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)]) |
31 if wrapper_args is not None: | 31 if wrapper_args is not None: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 # List of command line arguments common to all test platforms. | 75 # List of command line arguments common to all test platforms. |
76 common_args = ['-v', '--output-format=buildbot'] | 76 common_args = ['-v', '--output-format=buildbot'] |
77 | 77 |
78 if profile_type: | 78 if profile_type: |
79 profile_dir = os.path.join( | 79 profile_dir = os.path.join( |
80 build_dir, target, 'generated_profile', profile_type) | 80 build_dir, target, 'generated_profile', profile_type) |
81 common_args.append('--profile-dir=' + profile_dir) | 81 common_args.append('--profile-dir=' + profile_dir) |
82 if extra_args: | 82 if extra_args: |
83 common_args.extend(extra_args) | 83 common_args.extend(extra_args) |
84 | 84 |
85 # On android, telemetry needs to use the adb command and needs to be in | 85 commands = [] |
86 # root mode. Run it in bash since envsetup.sh doesn't work in sh. | |
87 if target_os == 'android': | |
88 env['PATH'] = os.pathsep.join(['/b/build_internal/scripts/slave/android', | |
89 env['PATH']]) | |
90 commands = [['adb', 'root'], ['adb', 'wait-for-device']] | |
91 else: | |
92 commands = [] | |
93 | 86 |
94 # Run the test against the target chrome build. | 87 # Run the test against the target chrome build. |
95 browser = target.lower() | 88 browser = target.lower() |
| 89 wrapper_args = None |
96 if target_os == 'android': | 90 if target_os == 'android': |
97 browser = options.target_android_browser | 91 browser = options.target_android_browser |
| 92 wrapper_args = ['src/build/android/test_runner.py', 'perf', '-v', |
| 93 '--single-step'] |
98 # If an executable is passed, use that instead. | 94 # If an executable is passed, use that instead. |
99 if browser_exe: | 95 if browser_exe: |
100 browser_info = ['--browser=exact', | 96 browser_info = ['--browser=exact', |
101 '--browser-executable=%s' % browser_exe] | 97 '--browser-executable=%s' % browser_exe] |
102 else: | 98 else: |
103 browser_info = ['--browser=%s' % browser] | 99 browser_info = ['--browser=%s' % browser] |
104 test_args = list(common_args) | 100 test_args = list(common_args) |
105 test_args.extend(browser_info) | 101 test_args.extend(browser_info) |
106 test_args.extend(test_specification) | 102 test_args.extend(test_specification) |
107 test_cmd = _GetPythonTestCommand(script, target, test_args, fp=fp) | 103 test_cmd = _GetPythonTestCommand(script, target, test_args, |
| 104 wrapper_args=wrapper_args, fp=fp) |
108 commands.append(test_cmd) | 105 commands.append(test_cmd) |
109 | 106 |
110 # Run the test against the target chrome build for different user profiles on | 107 # Run the test against the target chrome build for different user profiles on |
111 # certain page cyclers. | 108 # certain page cyclers. |
112 if target_os != 'android': | 109 if target_os != 'android': |
113 if test_name in ('page_cycler_moz', 'page_cycler_morejs'): | 110 if test_name in ('page_cycler_moz', 'page_cycler_morejs'): |
114 test_args = list(common_args) | 111 test_args = list(common_args) |
115 test_args.extend(['--profile-type=typical_user', | 112 test_args.extend(['--profile-type=typical_user', |
116 '--output-trace-tag=_extcs1']) | 113 '--output-trace-tag=_extcs1']) |
117 test_args.extend(browser_info) | 114 test_args.extend(browser_info) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 continue | 165 continue |
169 | 166 |
170 retval = chromium_utils.RunCommand(command, env=env) | 167 retval = chromium_utils.RunCommand(command, env=env) |
171 if retval != 0: | 168 if retval != 0: |
172 break | 169 break |
173 return retval | 170 return retval |
174 | 171 |
175 | 172 |
176 if '__main__' == __name__: | 173 if '__main__' == __name__: |
177 sys.exit(main(sys.argv)) | 174 sys.exit(main(sys.argv)) |
OLD | NEW |