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 |
11 import sys | 11 import sys |
12 | 12 |
13 import bb_utils | 13 import bb_utils |
14 import bb_annotations | 14 import bb_annotations |
15 | 15 |
16 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 16 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 17 import provision_devices |
17 from pylib import android_commands | 18 from pylib import android_commands |
18 from pylib import constants | 19 from pylib import constants |
19 from pylib.gtest import gtest_config | 20 from pylib.gtest import gtest_config |
20 | 21 |
21 sys.path.append(os.path.join( | 22 sys.path.append(os.path.join( |
22 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner')) | 23 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner')) |
23 import errors | 24 import errors |
24 | 25 |
25 | 26 |
26 CHROME_SRC = constants.DIR_SOURCE_ROOT | 27 CHROME_SRC = constants.DIR_SOURCE_ROOT |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 245 |
245 def ProvisionDevices(options): | 246 def ProvisionDevices(options): |
246 # Restart adb to work around bugs, sleep to wait for usb discovery. | 247 # Restart adb to work around bugs, sleep to wait for usb discovery. |
247 RunCmd(['adb', 'kill-server']) | 248 RunCmd(['adb', 'kill-server']) |
248 RunCmd(['adb', 'start-server']) | 249 RunCmd(['adb', 'start-server']) |
249 RunCmd(['sleep', '1']) | 250 RunCmd(['sleep', '1']) |
250 | 251 |
251 bb_annotations.PrintNamedStep('provision_devices') | 252 bb_annotations.PrintNamedStep('provision_devices') |
252 if options.reboot: | 253 if options.reboot: |
253 RebootDevices() | 254 RebootDevices() |
254 RunCmd(['build/android/provision_devices.py', '-t', options.target]) | 255 provision_cmd = ['build/android/provision_devices.py', '-t', options.target] |
| 256 if options.auto_reconnect: |
| 257 provision_cmd.append('--auto-reconnect') |
| 258 RunCmd(provision_cmd) |
255 | 259 |
256 | 260 |
257 def DeviceStatusCheck(_): | 261 def DeviceStatusCheck(_): |
258 bb_annotations.PrintNamedStep('device_status_check') | 262 bb_annotations.PrintNamedStep('device_status_check') |
259 RunCmd(['build/android/device_status_check.py'], halt_on_failure=True) | 263 RunCmd(['build/android/device_status_check.py'], halt_on_failure=True) |
260 | 264 |
261 | 265 |
262 def GetDeviceSetupStepCmds(): | 266 def GetDeviceSetupStepCmds(): |
263 return [ | 267 return [ |
264 ('provision_devices', ProvisionDevices), | 268 ('provision_devices', ProvisionDevices), |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 if args: | 376 if args: |
373 return sys.exit('Unused args %s' % args) | 377 return sys.exit('Unused args %s' % args) |
374 | 378 |
375 unknown_tests = set(options.test_filter) - VALID_TESTS | 379 unknown_tests = set(options.test_filter) - VALID_TESTS |
376 if unknown_tests: | 380 if unknown_tests: |
377 return sys.exit('Unknown tests %s' % list(unknown_tests)) | 381 return sys.exit('Unknown tests %s' % list(unknown_tests)) |
378 | 382 |
379 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 383 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
380 | 384 |
381 MainTestWrapper(options) | 385 MainTestWrapper(options) |
| 386 provision_devices.KillHostHeartbeat() |
382 | 387 |
383 | 388 |
384 if __name__ == '__main__': | 389 if __name__ == '__main__': |
385 sys.exit(main(sys.argv)) | 390 sys.exit(main(sys.argv)) |
OLD | NEW |