OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Provisions Android devices with settings required for bots. | 7 """Provisions Android devices with settings required for bots. |
8 | 8 |
9 Usage: | 9 Usage: |
10 ./provision_devices.py [-d <device serial number>] | 10 ./provision_devices.py [-d <device serial number>] |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 logging.info(' %s' % prop) | 200 logging.info(' %s' % prop) |
201 if options.auto_reconnect: | 201 if options.auto_reconnect: |
202 PushAndLaunchAdbReboot(device, options.target) | 202 PushAndLaunchAdbReboot(device, options.target) |
203 except (errors.WaitForResponseTimedOutError, | 203 except (errors.WaitForResponseTimedOutError, |
204 device_errors.CommandTimeoutError): | 204 device_errors.CommandTimeoutError): |
205 logging.info('Timed out waiting for device %s. Adding to blacklist.', | 205 logging.info('Timed out waiting for device %s. Adding to blacklist.', |
206 str(device)) | 206 str(device)) |
207 # Device black list is reset by bb_device_status_check.py per build. | 207 # Device black list is reset by bb_device_status_check.py per build. |
208 device_blacklist.ExtendBlacklist([str(device)]) | 208 device_blacklist.ExtendBlacklist([str(device)]) |
209 except (device_errors.CommandFailedError): | 209 except (device_errors.CommandFailedError): |
210 logging.info('Failed to provision device %s. Adding to blacklist.', | 210 logging.exception('Failed to provision device %s. Adding to blacklist.', |
211 str(device)) | 211 str(device)) |
212 device_blacklist.ExtendBlacklist([str(device)]) | 212 device_blacklist.ExtendBlacklist([str(device)]) |
213 | 213 |
214 | 214 |
215 def ProvisionDevices(options): | 215 def ProvisionDevices(options): |
216 is_perf = 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower() | 216 is_perf = 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower() |
217 if options.device is not None: | 217 if options.device is not None: |
218 devices = [options.device] | 218 devices = [options.device] |
219 else: | 219 else: |
220 devices = android_commands.GetAttachedDevices() | 220 devices = android_commands.GetAttachedDevices() |
221 | 221 |
(...skipping 29 matching lines...) Expand all Loading... |
251 | 251 |
252 if args: | 252 if args: |
253 print >> sys.stderr, 'Unused args %s' % args | 253 print >> sys.stderr, 'Unused args %s' % args |
254 return 1 | 254 return 1 |
255 | 255 |
256 return ProvisionDevices(options) | 256 return ProvisionDevices(options) |
257 | 257 |
258 | 258 |
259 if __name__ == '__main__': | 259 if __name__ == '__main__': |
260 sys.exit(main(sys.argv)) | 260 sys.exit(main(sys.argv)) |
OLD | NEW |