OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 import collections | 6 import collections |
7 import glob | 7 import glob |
8 import hashlib | 8 import hashlib |
9 import json | 9 import json |
10 import os | 10 import os |
11 import random | 11 import random |
12 import re | 12 import re |
13 import shutil | 13 import shutil |
14 import sys | 14 import sys |
15 | 15 |
16 import bb_utils | 16 import bb_utils |
17 import bb_annotations | 17 import bb_annotations |
18 | 18 |
19 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 19 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
20 import provision_devices | 20 import provision_devices |
21 from pylib import android_commands | |
22 from pylib import constants | 21 from pylib import constants |
23 from pylib.device import device_utils | 22 from pylib.device import device_utils |
24 from pylib.gtest import gtest_config | 23 from pylib.gtest import gtest_config |
25 | 24 |
26 CHROME_SRC_DIR = bb_utils.CHROME_SRC | 25 CHROME_SRC_DIR = bb_utils.CHROME_SRC |
27 DIR_BUILD_ROOT = os.path.dirname(CHROME_SRC_DIR) | 26 DIR_BUILD_ROOT = os.path.dirname(CHROME_SRC_DIR) |
28 CHROME_OUT_DIR = bb_utils.CHROME_OUT_DIR | 27 CHROME_OUT_DIR = bb_utils.CHROME_OUT_DIR |
29 BLINK_SCRIPTS_DIR = 'third_party/WebKit/Tools/Scripts' | 28 BLINK_SCRIPTS_DIR = 'third_party/WebKit/Tools/Scripts' |
30 | 29 |
31 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') | 30 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 '--update-log']) | 206 '--update-log']) |
208 | 207 |
209 def RunChromeProxyTests(options): | 208 def RunChromeProxyTests(options): |
210 """Run the chrome_proxy tests. | 209 """Run the chrome_proxy tests. |
211 | 210 |
212 Args: | 211 Args: |
213 options: options object. | 212 options: options object. |
214 """ | 213 """ |
215 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) | 214 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) |
216 args = ['--browser', 'android-chrome-shell'] | 215 args = ['--browser', 'android-chrome-shell'] |
217 devices = android_commands.GetAttachedDevices() | 216 devices = device_utils.DeviceUtils.HealthyDevices() |
218 if devices: | 217 if devices: |
219 args = args + ['--device', devices[0]] | 218 args = args + ['--device', devices[0].adb.GetDeviceSerial()] |
220 bb_annotations.PrintNamedStep('chrome_proxy') | 219 bb_annotations.PrintNamedStep('chrome_proxy') |
221 RunCmd(['tools/chrome_proxy/run_tests'] + args) | 220 RunCmd(['tools/chrome_proxy/run_tests'] + args) |
222 | 221 |
223 | 222 |
224 def RunTelemetryTests(options, step_name, run_tests_path): | 223 def RunTelemetryTests(options, step_name, run_tests_path): |
225 """Runs either telemetry_perf_unittests or telemetry_unittests. | 224 """Runs either telemetry_perf_unittests or telemetry_unittests. |
226 | 225 |
227 Args: | 226 Args: |
228 options: options object. | 227 options: options object. |
229 step_name: either 'telemetry_unittests' or 'telemetry_perf_unittests' | 228 step_name: either 'telemetry_unittests' or 'telemetry_perf_unittests' |
230 run_tests_path: path to run_tests script (tools/perf/run_tests for | 229 run_tests_path: path to run_tests script (tools/perf/run_tests for |
231 perf_unittests and tools/telemetry/run_tests for | 230 perf_unittests and tools/telemetry/run_tests for |
232 telemetry_unittests) | 231 telemetry_unittests) |
233 """ | 232 """ |
234 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) | 233 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) |
235 args = ['--browser', 'android-chrome-shell'] | 234 args = ['--browser', 'android-chrome-shell'] |
236 devices = android_commands.GetAttachedDevices() | 235 devices = device_utils.DeviceUtils.HealthyDevices() |
237 if devices: | 236 if devices: |
238 args = args + ['--device', 'android'] | 237 args = args + ['--device', 'android'] |
239 bb_annotations.PrintNamedStep(step_name) | 238 bb_annotations.PrintNamedStep(step_name) |
240 RunCmd([run_tests_path] + args) | 239 RunCmd([run_tests_path] + args) |
241 | 240 |
242 | 241 |
243 def InstallApk(options, test, print_step=False): | 242 def InstallApk(options, test, print_step=False): |
244 """Install an apk to all phones. | 243 """Install an apk to all phones. |
245 | 244 |
246 Args: | 245 Args: |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 784 |
786 if options.coverage_bucket: | 785 if options.coverage_bucket: |
787 setattr(options, 'coverage_dir', | 786 setattr(options, 'coverage_dir', |
788 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 787 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
789 | 788 |
790 MainTestWrapper(options) | 789 MainTestWrapper(options) |
791 | 790 |
792 | 791 |
793 if __name__ == '__main__': | 792 if __name__ == '__main__': |
794 sys.exit(main(sys.argv)) | 793 sys.exit(main(sys.argv)) |
OLD | NEW |