Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2881)

Unified Diff: build/android/buildbot/bb_device_status_check.py

Issue 1392763002: [Android] Add a hard reset to device_status_check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better exception handling Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/buildbot/bb_device_status_check.py
diff --git a/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py
index 0a7cfd6c224b91e183e5a763f4bc27b4a90a3f66..ff9afc3fbbbc4eb48590924796f2fc17d99c409d 100755
--- a/build/android/buildbot/bb_device_status_check.py
+++ b/build/android/buildbot/bb_device_status_check.py
@@ -245,9 +245,9 @@ def RecoverDevices(devices, blacklist):
logging.debug('%s is blacklisted, skipping recovery.', str(device))
return
- if device in should_reboot_device:
+ if str(device) in should_reboot_device:
try:
- device.WaitUntilFullyBooted()
+ device.WaitUntilFullyBooted(retries=0)
return
except (device_errors.CommandTimeoutError,
device_errors.CommandFailedError):
@@ -255,14 +255,33 @@ def RecoverDevices(devices, blacklist):
'Attempting to recover.', str(device))
try:
- device.Reboot()
- device.WaitUntilFullyBooted()
+ try:
+ device.Reboot(block=False, timeout=5, retries=0)
+ except device_errors.CommandTimeoutError:
+ logging.warning('Timed out while attempting to reboot %s normally.'
+ 'Attempting alternative reboot.', str(device))
+ # The device drops offline before we can grab the exit code, so
+ # we don't check for status.
+ device.adb.Root()
+ device.adb.Shell('echo b > /proc/sysrq-trigger', expect_status=None,
+ timeout=5, retries=0)
+ except device_errors.CommandFailedError:
+ logging.exception('Failed to reboot %s.', str(device))
+ if blacklist:
+ blacklist.Extend([device.adb.GetDeviceSerial()])
+ except device_errors.CommandTimeoutError:
+ logging.exception('Timed out while rebooting %s.', str(device))
+ if blacklist:
+ blacklist.Extend([device.adb.GetDeviceSerial()])
+
+ try:
+ device.WaitUntilFullyBooted(retries=0)
except device_errors.CommandFailedError:
logging.exception('Failure while waiting for %s.', str(device))
if blacklist:
blacklist.Extend([device.adb.GetDeviceSerial()])
except device_errors.CommandTimeoutError:
- logging.exception('Timed out while waiting for %s. ', str(device))
+ logging.exception('Timed out while waiting for %s.', str(device))
if blacklist:
blacklist.Extend([device.adb.GetDeviceSerial()])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698