Bug 1172174 - Improve adb timeout handling for Android; r=armenzg

This commit is contained in:
Geoff Brown 2015-06-10 09:17:44 -06:00
parent da2f44c856
commit 6a2b69b4b9

View File

@ -134,11 +134,11 @@ class DeviceManagerADB(DeviceManager):
args.extend(['-s', self._deviceSerial])
args.extend(["shell", cmdline])
def _raise():
raise DMError("Timeout exceeded for shell call")
def _timeout():
self._logger.error("Timeout exceeded for shell call '%s'" % ' '.join(args))
self._logger.debug("shell - command: %s" % ' '.join(args))
proc = ProcessHandler(args, processOutputLine=self._log, onTimeout=_raise)
proc = ProcessHandler(args, processOutputLine=self._log, onTimeout=_timeout)
if not timeout:
# We are asserting that all commands will complete in this time unless otherwise specified
@ -591,10 +591,13 @@ class DeviceManagerADB(DeviceManager):
# time unless otherwise specified
timeout = self.default_timeout
def _timeout():
self._logger.error("Timeout exceeded for _checkCmd call '%s'" % ' '.join(finalArgs))
timeout = int(timeout)
retries = 0
while retries < retryLimit:
proc = ProcessHandler(finalArgs, processOutputLine=self._log)
proc = ProcessHandler(finalArgs, processOutputLine=self._log, onTimeout=_timeout)
proc.run(timeout=timeout)
ret_code = proc.wait()
if ret_code == None: