OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 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 """A class to keep track of devices across builds and report state.""" | 7 """A class to keep track of devices across builds and report state.""" |
8 import logging | 8 import logging |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 parser.add_option('--no-provisioning-check', action='store_true', | 286 parser.add_option('--no-provisioning-check', action='store_true', |
287 help='Will not check if devices are provisioned properly.') | 287 help='Will not check if devices are provisioned properly.') |
288 parser.add_option('--device-status-dashboard', action='store_true', | 288 parser.add_option('--device-status-dashboard', action='store_true', |
289 help='Output device status data for dashboard.') | 289 help='Output device status data for dashboard.') |
290 parser.add_option('--restart-usb', action='store_true', | 290 parser.add_option('--restart-usb', action='store_true', |
291 help='Restart USB ports before running device check.') | 291 help='Restart USB ports before running device check.') |
292 options, args = parser.parse_args() | 292 options, args = parser.parse_args() |
293 if args: | 293 if args: |
294 parser.error('Unknown options %s' % args) | 294 parser.error('Unknown options %s' % args) |
295 | 295 |
| 296 # Remove the last builds "bad devices" before checking device statuses. |
| 297 android_commands.ResetBadDevices() |
| 298 |
296 if options.restart_usb: | 299 if options.restart_usb: |
297 expected_devices = GetLastDevices(os.path.abspath(options.out_dir)) | 300 expected_devices = GetLastDevices(os.path.abspath(options.out_dir)) |
298 devices = android_commands.GetAttachedDevices() | 301 devices = android_commands.GetAttachedDevices() |
299 # Only restart usb if devices are missing. | 302 # Only restart usb if devices are missing. |
300 if set(expected_devices) != set(devices): | 303 if set(expected_devices) != set(devices): |
301 KillAllAdb() | 304 KillAllAdb() |
302 retries = 5 | 305 retries = 5 |
303 usb_restarted = True | 306 usb_restarted = True |
304 if not RestartUsb(): | 307 if not RestartUsb(): |
305 usb_restarted = False | 308 usb_restarted = False |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 # devices with critically low battery or install speed. Remove those devices | 368 # devices with critically low battery or install speed. Remove those devices |
366 # from testing, allowing build to continue with good devices. | 369 # from testing, allowing build to continue with good devices. |
367 return 1 | 370 return 1 |
368 | 371 |
369 if not devices: | 372 if not devices: |
370 return 1 | 373 return 1 |
371 | 374 |
372 | 375 |
373 if __name__ == '__main__': | 376 if __name__ == '__main__': |
374 sys.exit(main()) | 377 sys.exit(main()) |
OLD | NEW |