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

Unified Diff: mojo/devtools/common/devtoolslib/apptest.py

Issue 1266623002: Impose max running time for apptests. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Indicate time unit when printing out the time out value. Created 5 years, 5 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 | « mojo/devtools/common/devtoolslib/android_shell.py ('k') | mojo/devtools/common/devtoolslib/apptest_dart.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/apptest.py
diff --git a/mojo/devtools/common/devtoolslib/apptest.py b/mojo/devtools/common/devtoolslib/apptest.py
index 463c6872c3c0fb71f9003fddceb4af7b711150ae..44c604306c84be8a17ce4be56fc4f9507146755b 100644
--- a/mojo/devtools/common/devtoolslib/apptest.py
+++ b/mojo/devtools/common/devtoolslib/apptest.py
@@ -31,7 +31,8 @@ def _build_shell_arguments(shell_args, apptest_url, apptest_args):
return result
-def run_apptest(shell, shell_args, apptest_url, apptest_args, output_test):
+def run_apptest(shell, shell_args, apptest_url, apptest_args, timeout,
+ output_test):
"""Runs shell with the given arguments, retrieves the output and applies
|output_test| to determine if the run was successful.
@@ -52,7 +53,7 @@ def run_apptest(shell, shell_args, apptest_url, apptest_args, output_test):
_logger.debug("Starting: " + command_line)
start_time = time.time()
- (exit_code, output) = shell.RunAndGetOutput(arguments)
+ (exit_code, output, did_time_out) = shell.RunAndGetOutput(arguments, timeout)
run_time = time.time() - start_time
_logger.debug("Completed: " + command_line)
@@ -60,10 +61,12 @@ def run_apptest(shell, shell_args, apptest_url, apptest_args, output_test):
if run_time >= 3:
_logger.info("Test took %.3f seconds: %s" % (run_time, command_line))
- if exit_code or not output_test(output):
+ if exit_code or did_time_out or not output_test(output):
print 'Failed test: %r' % command_line
if exit_code:
print ' due to shell exit code %d' % exit_code
+ elif did_time_out:
+ print ' due to exceeded timeout of %fs' % timeout
else:
print ' due to test results'
print 72 * '-'
« no previous file with comments | « mojo/devtools/common/devtoolslib/android_shell.py ('k') | mojo/devtools/common/devtoolslib/apptest_dart.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698