| 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 json | 8 import json |
| 9 import multiprocessing | 9 import multiprocessing |
| 10 import optparse | 10 import optparse |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" | 91 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" |
| 92 try: | 92 try: |
| 93 android_commands.AndroidCommands(device).Reboot(True) | 93 android_commands.AndroidCommands(device).Reboot(True) |
| 94 except errors.DeviceUnresponsiveError as e: | 94 except errors.DeviceUnresponsiveError as e: |
| 95 return e | 95 return e |
| 96 | 96 |
| 97 | 97 |
| 98 def RebootDevices(): | 98 def RebootDevices(): |
| 99 """Reboot all attached and online devices.""" | 99 """Reboot all attached and online devices.""" |
| 100 buildbot_report.PrintNamedStep('Reboot devices') | 100 buildbot_report.PrintNamedStep('Reboot devices') |
| 101 # Early return here to avoid presubmit dependence on adb, |
| 102 # which might not exist in this checkout. |
| 103 if TESTING: |
| 104 return |
| 101 devices = android_commands.GetAttachedDevices() | 105 devices = android_commands.GetAttachedDevices() |
| 102 print 'Rebooting: %s' % devices | 106 print 'Rebooting: %s' % devices |
| 103 if devices and not TESTING: | 107 if devices: |
| 104 pool = multiprocessing.Pool(len(devices)) | 108 pool = multiprocessing.Pool(len(devices)) |
| 105 results = pool.map_async(RebootDeviceSafe, devices).get(99999) | 109 results = pool.map_async(RebootDeviceSafe, devices).get(99999) |
| 106 | 110 |
| 107 for device, result in zip(devices, results): | 111 for device, result in zip(devices, results): |
| 108 if result: | 112 if result: |
| 109 print '%s failed to startup.' % device | 113 print '%s failed to startup.' % device |
| 110 | 114 |
| 111 if any(results): | 115 if any(results): |
| 112 buildbot_report.PrintWarning() | 116 buildbot_report.PrintWarning() |
| 113 else: | 117 else: |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 'slave', 'android')) | 305 'slave', 'android')) |
| 302 if os.path.exists(build_internal_android): | 306 if os.path.exists(build_internal_android): |
| 303 android_paths.insert(0, build_internal_android) | 307 android_paths.insert(0, build_internal_android) |
| 304 os.environ['PATH'] = os.pathsep.join(android_paths + [os.environ['PATH']]) | 308 os.environ['PATH'] = os.pathsep.join(android_paths + [os.environ['PATH']]) |
| 305 | 309 |
| 306 MainTestWrapper(options) | 310 MainTestWrapper(options) |
| 307 | 311 |
| 308 | 312 |
| 309 if __name__ == '__main__': | 313 if __name__ == '__main__': |
| 310 sys.exit(main(sys.argv)) | 314 sys.exit(main(sys.argv)) |
| OLD | NEW |