 Chromium Code Reviews
 Chromium Code Reviews Issue 59753003:
  Don't stop because we couldn't restart usb devices.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 59753003:
  Don't stop because we couldn't restart usb devices.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 options, args = parser.parse_args() | 285 options, args = parser.parse_args() | 
| 286 if args: | 286 if args: | 
| 287 parser.error('Unknown options %s' % args) | 287 parser.error('Unknown options %s' % args) | 
| 288 | 288 | 
| 289 if options.restart_usb: | 289 if options.restart_usb: | 
| 290 expected_devices = GetLastDevices(os.path.abspath(options.out_dir)) | 290 expected_devices = GetLastDevices(os.path.abspath(options.out_dir)) | 
| 291 devices = android_commands.GetAttachedDevices() | 291 devices = android_commands.GetAttachedDevices() | 
| 292 # Only restart usb if devices are missing | 292 # Only restart usb if devices are missing | 
| 293 if set(expected_devices) != set(devices): | 293 if set(expected_devices) != set(devices): | 
| 294 KillAllAdb() | 294 KillAllAdb() | 
| 295 retries = 5 | |
| 295 if RestartUsb(): | 296 if RestartUsb(): | 
| 296 return 1 | 297 bb_annotations.PrintWarning() | 
| 297 retries = 5 | 298 print "USB reset stage failed, continuing anyway." | 
| 
bulach
2013/11/05 18:21:09
nit: I think the PrintWarning() needs to come afte
 | |
| 299 retries = 0 | |
| 298 while retries: | 300 while retries: | 
| 299 time.sleep(1) | 301 time.sleep(1) | 
| 300 devices = android_commands.GetAttachedDevices() | 302 devices = android_commands.GetAttachedDevices() | 
| 301 if set(expected_devices) == set(devices): | 303 if set(expected_devices) == set(devices): | 
| 302 break | 304 break | 
| 303 retries -= 1 | 305 retries -= 1 | 
| 304 | 306 | 
| 305 devices = android_commands.GetAttachedDevices() | 307 devices = android_commands.GetAttachedDevices() | 
| 306 # TODO(navabi): Test to make sure this fails and then fix call | 308 # TODO(navabi): Test to make sure this fails and then fix call | 
| 307 offline_devices = android_commands.GetAttachedDevices(hardware=False, | 309 offline_devices = android_commands.GetAttachedDevices(hardware=False, | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 # devices with critically low battery or install speed. Remove those devices | 352 # devices with critically low battery or install speed. Remove those devices | 
| 351 # from testing, allowing build to continue with good devices. | 353 # from testing, allowing build to continue with good devices. | 
| 352 return 1 | 354 return 1 | 
| 353 | 355 | 
| 354 if not devices: | 356 if not devices: | 
| 355 return 1 | 357 return 1 | 
| 356 | 358 | 
| 357 | 359 | 
| 358 if __name__ == '__main__': | 360 if __name__ == '__main__': | 
| 359 sys.exit(main()) | 361 sys.exit(main()) | 
| OLD | NEW |