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

Unified Diff: third_party/android_testrunner/adb_interface.py

Issue 10824227: Organize adb install cmds and reboot on failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: third_party/android_testrunner/adb_interface.py
diff --git a/third_party/android_testrunner/adb_interface.py b/third_party/android_testrunner/adb_interface.py
index b8f740b2f01b2e31e13cb84c1ed6c95af02b41a3..c6f8b5731ecca313ae51d62369f9e64d7a8ad1b3 100644
--- a/third_party/android_testrunner/adb_interface.py
+++ b/third_party/android_testrunner/adb_interface.py
@@ -51,7 +51,8 @@ class AdbInterface:
"""Direct all future commands to Android target with the given serial."""
self._target_arg = "-s %s" % serial
- def SendCommand(self, command_string, timeout_time=20, retry_count=3):
+ def SendCommand(self, command_string, timeout_time=20, retry_count=3,
+ cmd_logger=None):
"""Send a command via adb.
Args:
@@ -68,10 +69,13 @@ class AdbInterface:
"""
adb_cmd = "adb %s %s" % (self._target_arg, command_string)
logger.SilentLog("about to run %s" % adb_cmd)
+ if cmd_logger:
+ cmd_logger.info('>>> $ %s' % adb_cmd)
return run_command.RunCommand(adb_cmd, timeout_time=timeout_time,
retry_count=retry_count)
- def SendShellCommand(self, cmd, timeout_time=20, retry_count=3):
+ def SendShellCommand(self, cmd, timeout_time=20, retry_count=3,
+ cmd_logger=None):
"""Send a adb shell command.
Args:
@@ -88,7 +92,7 @@ class AdbInterface:
WaitForResponseTimedOutError: if device does not respond to command
"""
return self.SendCommand("shell %s" % cmd, timeout_time=timeout_time,
- retry_count=retry_count)
+ retry_count=retry_count, cmd_logger=cmd_logger)
def BugReport(self, path):
"""Dumps adb bugreport to the file specified by the path.
@@ -157,6 +161,8 @@ class AdbInterface:
# device will disappear from adb, wait for it to come back
self.SendCommand("wait-for-device")
return True
+ elif "adbd cannot run as root" in output:
+ return False
else:
logger.Log("Unrecognized output from adb root: %s" % output)
return False

Powered by Google App Engine
This is Rietveld 408576698