Bug 1136700 - enable tweaking of the maximum number of timeouts for mochitests; r=jmaher

When running tests locally, it's occasionally useful to be able to
increase the number of tests permitted to timeout before declaring the
test run a failure.  This patch adds the necessary bits to SimpleTest
and the appropriate amount of plumbing to runtests.py and mach to make
that so.
This commit is contained in:
Nathan Froyd 2015-02-25 09:23:54 -05:00
parent dbf4ddd6f6
commit c39386bb80
4 changed files with 19 additions and 0 deletions

View File

@ -256,6 +256,7 @@ class MochitestRunner(MozbuildObject):
runByDir=False,
useTestMediaDevices=False,
timeout=None,
max_timeouts=None,
**kwargs):
"""Runs a mochitest.
@ -393,6 +394,8 @@ class MochitestRunner(MozbuildObject):
options.useTestMediaDevices = useTestMediaDevices
if timeout:
options.timeout = int(timeout)
if max_timeouts:
options.maxTimeouts = int(max_timeouts)
options.failureFile = failure_file_path
if install_extension is not None:
@ -729,6 +732,10 @@ def MochitestCommand(func):
help='The per-test timeout time in seconds (default: 60 seconds)')
func = timeout(func)
max_timeouts = CommandArgument('--max-timeouts', default=None,
help='The maximum number of timeouts permitted before halting testing')
func = max_timeouts(func)
return func

View File

@ -478,6 +478,12 @@ class MochitestOptions(optparse.OptionParser):
"dest": "debuggerInteractive",
"help": "prevents the test harness from redirecting stdout and stderr for interactive debuggers",
}],
[["--max-timeouts"],
{ "type": "int",
"dest": "maxTimeouts",
"help": "maximum number of timeouts permitted before halting testing",
"default": None,
}],
]
def __init__(self, **kwargs):

View File

@ -592,6 +592,8 @@ class MochitestUtilsMixin(object):
self.urlOpts.append("autorun=1")
if options.timeout:
self.urlOpts.append("timeout=%d" % options.timeout)
if options.maxTimeouts:
self.urlOpts.append("maxTimeouts=%d" % options.maxTimeouts)
if options.closeWhenDone:
self.urlOpts.append("closeWhenDone=1")
if options.webapprtContent:

View File

@ -146,6 +146,10 @@ if (params.interactiveDebugger) {
TestRunner.structuredLogger.interactiveDebugger = true;
}
if (params.maxTimeouts) {
TestRunner.maxTimeouts = params.maxTimeouts;
}
// Log things to the console if appropriate.
TestRunner.logger.addListener("dumpListener", consoleLevel + "", function(msg) {
dump(msg.info.join(' ') + "\n");