Bug 521130. Add a --timeout parameter to runtests.py, and change the --timeout parameter in runreftests.py to use s instead of ms. r=ted

This commit is contained in:
Jonathan Griffin 2009-10-16 13:23:30 -07:00
parent 32f3c51234
commit 31d5e938ed
3 changed files with 16 additions and 3 deletions

View File

@ -63,7 +63,7 @@ def createReftestProfile(options, profileDir):
prefsFile = open(os.path.join(profileDir, "user.js"), "w")
prefsFile.write("""user_pref("browser.dom.window.dump.enabled", true);
""")
prefsFile.write('user_pref("reftest.timeout", %d);' % options.timeout)
prefsFile.write('user_pref("reftest.timeout", %d);' % (options.timeout * 1000))
prefsFile.write('user_pref("ui.caretBlinkTime", -1);')
prefsFile.close()
@ -90,8 +90,8 @@ def main():
help = "copy specified files/dirs to testing profile")
parser.add_option("--timeout",
action = "store", dest = "timeout", type = "int",
default = 5 * 60 * 1000, # 5 minutes per bug 479518
help = "reftest will timeout in specified number of milleseconds. [default %default ms].")
default = 5 * 60, # 5 minutes per bug 479518
help = "reftest will timeout in specified number of seconds. [default %default s].")
parser.add_option("--leak-threshold",
action = "store", type = "int", dest = "leakThreshold",
default = 0,

View File

@ -148,6 +148,11 @@ class MochitestOptions(optparse.OptionParser):
action = "store_true", dest = "autorun",
help = "start running tests when the application starts")
defaults["autorun"] = False
self.add_option("--timeout",
type = "int", dest = "timeout",
help = "per-test timeout in seconds")
defaults["timeout"] = None
self.add_option("--total-chunks",
type = "int", dest = "totalChunks",
@ -451,6 +456,7 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
# logFile -- logs test run to an absolute path
# totalChunks -- how many chunks to split tests into
# thisChunk -- which chunk to run
# timeout -- per-test timeout in seconds
#
# consoleLevel, fileLevel: set the logging level of the console and
@ -478,6 +484,8 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
else:
if options.autorun:
urlOpts.append("autorun=1")
if options.timeout:
urlOpts.append("timeout=%d" % options.timeout)
if options.closeWhenDone:
urlOpts.append("closeWhenDone=1")
if options.logFile:

View File

@ -42,6 +42,11 @@ TestRunner.logger = new Logger();
// Check the query string for arguments
var params = parseQueryString(location.search.substring(1), true);
// set the per-test timeout if specified in the query string
if (params.timeout) {
TestRunner.timeout = parseInt(params.timeout) * 1000;
}
// log levels for console and logfile
var fileLevel = params.fileLevel || null;
var consoleLevel = params.consoleLevel || null;