[tools] Print command output on timeout

R=machenbach@chromium.org

Bug: chromium:872257
Change-Id: I6eb1f70e0d44c76e18eb4f6f936c7f2cf0380444
Reviewed-on: https://chromium-review.googlesource.com/1217942
Commit-Queue: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55834}
This commit is contained in:
Sergiy Byelozyorov 2018-09-12 16:57:46 +02:00 committed by Commit Bot
parent d970749152
commit 1a236fb899
3 changed files with 8 additions and 5 deletions

2
DEPS
View File

@ -33,7 +33,7 @@ deps = {
'condition': 'checkout_android',
},
'v8/third_party/catapult': {
'url': Var('chromium_url') + '/catapult.git' + '@' + '134ee369521c676229d0c4c38a96fb54a5ab4967',
'url': Var('chromium_url') + '/catapult.git' + '@' + '79834ec727ba63d7364a46cef7c85284b7152266',
'condition': 'checkout_android',
},
'v8/third_party/colorama/src': {

View File

@ -780,7 +780,9 @@ class AndroidPlatform(Platform): # pragma: no cover
except android.CommandFailedException as e:
logging.info(title % "Stdout" + "\n%s", e.output)
raise
except android.TimeoutException:
except android.TimeoutException as e:
if e.output:
logging.info(title % "Stdout" + "\n%s", e.output)
logging.warning(">>> Test timed out after %ss.", runnable.timeout)
stdout = ""
if runnable.process_size:

View File

@ -18,8 +18,9 @@ DEVICE_DIR = '/data/local/tmp/v8/'
class TimeoutException(Exception):
def __init__(self, timeout):
def __init__(self, timeout, output=None):
self.timeout = timeout
self.output = output
class CommandFailedException(Exception):
@ -170,8 +171,8 @@ class _Driver(object):
return '\n'.join(output)
except device_errors.AdbCommandFailedError as e:
raise CommandFailedException(e.status, e.output)
except device_errors.CommandTimeoutError:
raise TimeoutException(timeout)
except device_errors.CommandTimeoutError as e:
raise TimeoutException(timeout, e.output)
if logcat_file: