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 |