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 multiprocessing | 8 import multiprocessing |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 def RebootDeviceSafe(device): | 64 def RebootDeviceSafe(device): |
65 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" | 65 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" |
66 try: | 66 try: |
67 android_commands.AndroidCommands(device).Reboot(True) | 67 android_commands.AndroidCommands(device).Reboot(True) |
68 except errors.DeviceUnresponsiveError as e: | 68 except errors.DeviceUnresponsiveError as e: |
69 return e | 69 return e |
70 | 70 |
71 | 71 |
72 def RebootDevices(): | 72 def RebootDevices(): |
73 """Reboot all attached and online devices.""" | 73 """Reboot all attached and online devices.""" |
74 buildbot_report.PrintNamedStep('Reboot devices') | |
75 # Early return here to avoid presubmit dependence on adb, | 74 # Early return here to avoid presubmit dependence on adb, |
76 # which might not exist in this checkout. | 75 # which might not exist in this checkout. |
77 if bb_utils.TESTING: | 76 if bb_utils.TESTING: |
78 return | 77 return |
79 devices = android_commands.GetAttachedDevices() | 78 devices = android_commands.GetAttachedDevices() |
80 print 'Rebooting: %s' % devices | 79 print 'Rebooting: %s' % devices |
81 if devices: | 80 if devices: |
82 pool = multiprocessing.Pool(len(devices)) | 81 pool = multiprocessing.Pool(len(devices)) |
83 results = pool.map_async(RebootDeviceSafe, devices).get(99999) | 82 results = pool.map_async(RebootDeviceSafe, devices).get(99999) |
84 | 83 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 RunCmd(['sleep', '1']) | 226 RunCmd(['sleep', '1']) |
228 | 227 |
229 # Spawn logcat monitor | 228 # Spawn logcat monitor |
230 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat') | 229 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat') |
231 shutil.rmtree(logcat_dir, ignore_errors=True) | 230 shutil.rmtree(logcat_dir, ignore_errors=True) |
232 bb_utils.SpawnCmd(['build/android/adb_logcat_monitor.py', logcat_dir]) | 231 bb_utils.SpawnCmd(['build/android/adb_logcat_monitor.py', logcat_dir]) |
233 | 232 |
234 # Wait for logcat_monitor to pull existing logcat | 233 # Wait for logcat_monitor to pull existing logcat |
235 RunCmd(['sleep', '5']) | 234 RunCmd(['sleep', '5']) |
236 | 235 |
| 236 # Provision devices |
| 237 buildbot_report.PrintNamedStep('provision_devices') |
237 if options.reboot: | 238 if options.reboot: |
238 RebootDevices() | 239 RebootDevices() |
| 240 RunCmd(['build/android/provision_devices.py', '-t', options.target]) |
239 | 241 |
240 # Device check and alert emails | 242 # Device check and alert emails |
241 buildbot_report.PrintNamedStep('device_status_check') | 243 buildbot_report.PrintNamedStep('device_status_check') |
242 RunCmd(['build/android/device_status_check.py'], halt_on_failure=True) | 244 RunCmd(['build/android/device_status_check.py'], halt_on_failure=True) |
243 | 245 |
244 # Provision devices | |
245 buildbot_report.PrintNamedStep('provision_devices') | |
246 target = options.factory_properties.get('target', 'Debug') | |
247 RunCmd(['build/android/provision_devices.py', '-t', target]) | |
248 | |
249 if options.install: | 246 if options.install: |
250 test_obj = INSTRUMENTATION_TESTS[options.install] | 247 test_obj = INSTRUMENTATION_TESTS[options.install] |
251 InstallApk(options, test_obj, print_step=True) | 248 InstallApk(options, test_obj, print_step=True) |
252 | 249 |
253 if 'chromedriver' in options.test_filter: | 250 if 'chromedriver' in options.test_filter: |
254 RunChromeDriverTests() | 251 RunChromeDriverTests() |
255 if 'unit' in options.test_filter: | 252 if 'unit' in options.test_filter: |
256 RunTestSuites(options, gtest_config.STABLE_TEST_SUITES) | 253 RunTestSuites(options, gtest_config.STABLE_TEST_SUITES) |
257 if 'ui' in options.test_filter: | 254 if 'ui' in options.test_filter: |
258 for test in INSTRUMENTATION_TESTS.itervalues(): | 255 for test in INSTRUMENTATION_TESTS.itervalues(): |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 'slave', 'android')) | 315 'slave', 'android')) |
319 if os.path.exists(build_internal_android): | 316 if os.path.exists(build_internal_android): |
320 android_paths.insert(0, build_internal_android) | 317 android_paths.insert(0, build_internal_android) |
321 os.environ['PATH'] = os.pathsep.join(android_paths + [os.environ['PATH']]) | 318 os.environ['PATH'] = os.pathsep.join(android_paths + [os.environ['PATH']]) |
322 | 319 |
323 MainTestWrapper(options) | 320 MainTestWrapper(options) |
324 | 321 |
325 | 322 |
326 if __name__ == '__main__': | 323 if __name__ == '__main__': |
327 sys.exit(main(sys.argv)) | 324 sys.exit(main(sys.argv)) |
OLD | NEW |