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

Unified Diff: devil/devil/android/sdk/adb_wrapper.py

Issue 3002993002: devil: Raise DeviceUnreachableError on cmd output "waiting for device" (Closed)
Patch Set: Created 3 years, 4 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 | devil/devil/android/sdk/adb_wrapper_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/sdk/adb_wrapper.py
diff --git a/devil/devil/android/sdk/adb_wrapper.py b/devil/devil/android/sdk/adb_wrapper.py
index 5336c4899212331bfa5a746662a3aa78e7773577..fffcce84c887dd75e6a6075a8171f597d5b5e019 100644
--- a/devil/devil/android/sdk/adb_wrapper.py
+++ b/devil/devil/android/sdk/adb_wrapper.py
@@ -41,6 +41,7 @@ _DEVICE_NOT_FOUND_RE = re.compile(r"error: device '(?P<serial>.+)' not found")
_READY_STATE = 'device'
_VERITY_DISABLE_RE = re.compile(r'Verity (already )?disabled')
_VERITY_ENABLE_RE = re.compile(r'Verity (already )?enabled')
+_WAITING_FOR_DEVICE_RE = re.compile(r'- waiting for device -')
def VerifyLocalFileExists(path):
@@ -269,8 +270,10 @@ class AdbWrapper(object):
# inconsistent with error reporting so many command failures present
# differently.
if status != 0 or (check_error and output.startswith('error:')):
- m = _DEVICE_NOT_FOUND_RE.match(output)
- if m is not None and m.group('serial') == device_serial:
+ not_found_m = _DEVICE_NOT_FOUND_RE.match(output)
+ device_waiting_m = _WAITING_FOR_DEVICE_RE.match(output)
+ if device_waiting_m is not None or (not_found_m is not None and
jbudorick 2017/08/19 00:22:13 nit: this would be a bit easier to read w/ the lin
bpastene 2017/08/19 00:50:31 Done.
+ not_found_m.group('serial') == device_serial):
raise device_errors.DeviceUnreachableError(device_serial)
else:
raise device_errors.AdbCommandFailedError(
« no previous file with comments | « no previous file | devil/devil/android/sdk/adb_wrapper_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698