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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 '--update-log']) | 207 '--update-log']) |
209 | 208 |
210 def RunChromeProxyTests(options): | 209 def RunChromeProxyTests(options): |
211 """Run the chrome_proxy tests. | 210 """Run the chrome_proxy tests. |
212 | 211 |
213 Args: | 212 Args: |
214 options: options object. | 213 options: options object. |
215 """ | 214 """ |
216 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) | 215 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) |
217 args = ['--browser', 'android-chrome-shell'] | 216 args = ['--browser', 'android-chrome-shell'] |
218 devices = android_commands.GetAttachedDevices() | 217 devices = device_utils.DeviceUtils.HealthyDevices() |
219 if devices: | 218 if devices: |
220 args = args + ['--device', devices[0]] | 219 args = args + ['--device', devices[0].adb.GetDeviceSerial()] |
221 bb_annotations.PrintNamedStep('chrome_proxy') | 220 bb_annotations.PrintNamedStep('chrome_proxy') |
222 RunCmd(['tools/chrome_proxy/run_tests'] + args) | 221 RunCmd(['tools/chrome_proxy/run_tests'] + args) |
223 | 222 |
224 | 223 |
225 def RunTelemetryTests(options, step_name, run_tests_path): | 224 def RunTelemetryTests(options, step_name, run_tests_path): |
226 """Runs either telemetry_perf_unittests or telemetry_unittests. | 225 """Runs either telemetry_perf_unittests or telemetry_unittests. |
227 | 226 |
228 Args: | 227 Args: |
229 options: options object. | 228 options: options object. |
230 step_name: either 'telemetry_unittests' or 'telemetry_perf_unittests' | 229 step_name: either 'telemetry_unittests' or 'telemetry_perf_unittests' |
231 run_tests_path: path to run_tests script (tools/perf/run_tests for | 230 run_tests_path: path to run_tests script (tools/perf/run_tests for |
232 perf_unittests and tools/telemetry/run_tests for | 231 perf_unittests and tools/telemetry/run_tests for |
233 telemetry_unittests) | 232 telemetry_unittests) |
234 """ | 233 """ |
235 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) | 234 InstallApk(options, INSTRUMENTATION_TESTS['ChromeShell'], False) |
236 args = ['--browser', 'android-chrome-shell'] | 235 args = ['--browser', 'android-chrome-shell'] |
237 devices = android_commands.GetAttachedDevices() | 236 devices = device_utils.DeviceUtils.HealthyDevices() |
238 if devices: | 237 if devices: |
239 args = args + ['--device', 'android'] | 238 args = args + ['--device', 'android'] |
240 bb_annotations.PrintNamedStep(step_name) | 239 bb_annotations.PrintNamedStep(step_name) |
241 RunCmd([run_tests_path] + args) | 240 RunCmd([run_tests_path] + args) |
242 | 241 |
243 | 242 |
244 def InstallApk(options, test, print_step=False): | 243 def InstallApk(options, test, print_step=False): |
245 """Install an apk to all phones. | 244 """Install an apk to all phones. |
246 | 245 |
247 Args: | 246 Args: |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 787 |
789 if options.coverage_bucket: | 788 if options.coverage_bucket: |
790 setattr(options, 'coverage_dir', | 789 setattr(options, 'coverage_dir', |
791 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 790 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
792 | 791 |
793 MainTestWrapper(options) | 792 MainTestWrapper(options) |
794 | 793 |
795 | 794 |
796 if __name__ == '__main__': | 795 if __name__ == '__main__': |
797 sys.exit(main(sys.argv)) | 796 sys.exit(main(sys.argv)) |
OLD | NEW |