Add a timeout flag to runtest for running native tests on devices.
This commit is contained in:
@@ -112,6 +112,9 @@ class TestRunner(object):
|
|||||||
default=False, action="store_true",
|
default=False, action="store_true",
|
||||||
help="Run all tests defined as part of the continuous "
|
help="Run all tests defined as part of the continuous "
|
||||||
"test set")
|
"test set")
|
||||||
|
parser.add_option("--timeout", dest="timeout",
|
||||||
|
default=300, help="Set a timeout limit (in sec) for "
|
||||||
|
"running native tests on a device (default: 300 secs)")
|
||||||
|
|
||||||
group = optparse.OptionGroup(
|
group = optparse.OptionGroup(
|
||||||
parser, "Targets", "Use these options to direct tests to a specific "
|
parser, "Targets", "Use these options to direct tests to a specific "
|
||||||
@@ -384,7 +387,8 @@ class TestRunner(object):
|
|||||||
|
|
||||||
# Single quotes are needed to prevent the shell splitting it.
|
# Single quotes are needed to prevent the shell splitting it.
|
||||||
output = self._adb.SendShellCommand("'%s 2>&1;echo -n exit code:$?'" %
|
output = self._adb.SendShellCommand("'%s 2>&1;echo -n exit code:$?'" %
|
||||||
full_path)
|
full_path,
|
||||||
|
int(self._options.timeout))
|
||||||
success = output.endswith("exit code:0")
|
success = output.endswith("exit code:0")
|
||||||
logger.Log("%s... %s" % (f, success and "ok" or "failed"))
|
logger.Log("%s... %s" % (f, success and "ok" or "failed"))
|
||||||
# Print the captured output when the test failed.
|
# Print the captured output when the test failed.
|
||||||
|
|||||||
Reference in New Issue
Block a user