mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 428758 - Clean up runtests.py help messages: move log options into the individual log-level arguments, use custom variables instead of autogenerated ones for --foo=FOO, so FOO is more concise for a bunch of different foo. Also remove the restriction that --file-level must be provided if --log-file is provided by giving a default (we only use that default if a log file is specified). r=testingonlychange
This commit is contained in:
parent
a63e2836c1
commit
1752821aa1
@ -106,7 +106,8 @@ class MochitestOptions(optparse.OptionParser):
|
|||||||
defaults["app"] = automation.DEFAULT_APP
|
defaults["app"] = automation.DEFAULT_APP
|
||||||
|
|
||||||
self.add_option("--log-file",
|
self.add_option("--log-file",
|
||||||
action = "store", type = "string", dest = "logFile",
|
action = "store", type = "string",
|
||||||
|
dest = "logFile", metavar = "FILE",
|
||||||
help = "file to which logging occurs")
|
help = "file to which logging occurs")
|
||||||
defaults["logFile"] = ""
|
defaults["logFile"] = ""
|
||||||
|
|
||||||
@ -115,19 +116,23 @@ class MochitestOptions(optparse.OptionParser):
|
|||||||
help = "start running tests when the application starts")
|
help = "start running tests when the application starts")
|
||||||
defaults["autorun"] = False
|
defaults["autorun"] = False
|
||||||
|
|
||||||
LOG_LEVELS = ("DEBUG", "INFO", "ERROR", "FATAL", "WARNING")
|
LOG_LEVELS = ("DEBUG", "INFO", "WARNING", "ERROR", "FATAL")
|
||||||
|
LEVEL_STRING = ", ".join(LOG_LEVELS)
|
||||||
|
|
||||||
self.add_option("--console-level",
|
self.add_option("--console-level",
|
||||||
action = "store", type = "choice", dest = "consoleLevel",
|
action = "store", type = "choice", dest = "consoleLevel",
|
||||||
choices = LOG_LEVELS,
|
choices = LOG_LEVELS, metavar = "LEVEL",
|
||||||
help = "logging level of console logging")
|
help = "one of %s to determine the level of console "
|
||||||
|
"logging" % LEVEL_STRING)
|
||||||
defaults["consoleLevel"] = None
|
defaults["consoleLevel"] = None
|
||||||
|
|
||||||
self.add_option("--file-level",
|
self.add_option("--file-level",
|
||||||
action = "store", type = "choice", dest = "fileLevel",
|
action = "store", type = "choice", dest = "fileLevel",
|
||||||
choices = LOG_LEVELS,
|
choices = LOG_LEVELS, metavar = "LEVEL",
|
||||||
help = "logging level of file logging")
|
help = "one of %s to determine the level of file "
|
||||||
defaults["fileLevel"] = None
|
"logging if a file has been specified, defaulting "
|
||||||
|
"to INFO" % LEVEL_STRING)
|
||||||
|
defaults["fileLevel"] = "INFO"
|
||||||
|
|
||||||
self.add_option("--chrome",
|
self.add_option("--chrome",
|
||||||
action = "store_true", dest = "chrome",
|
action = "store_true", dest = "chrome",
|
||||||
@ -149,18 +154,21 @@ class MochitestOptions(optparse.OptionParser):
|
|||||||
help = "run accessibility Mochitests");
|
help = "run accessibility Mochitests");
|
||||||
|
|
||||||
self.add_option("--setenv",
|
self.add_option("--setenv",
|
||||||
action = "append", type = "string", dest = "environment",
|
action = "append", type = "string",
|
||||||
help = "given a VAR=value pair, sets that in the "
|
dest = "environment", metavar = "NAME=VALUE",
|
||||||
"browser's environment")
|
help = "sets the given variable in the application's "
|
||||||
|
"environment")
|
||||||
defaults["environment"] = []
|
defaults["environment"] = []
|
||||||
|
|
||||||
self.add_option("--browser-arg",
|
self.add_option("--browser-arg",
|
||||||
action = "append", type = "string", dest = "browserArgs",
|
action = "append", type = "string",
|
||||||
|
dest = "browserArgs", metavar = "ARG",
|
||||||
help = "provides an argument to the test application")
|
help = "provides an argument to the test application")
|
||||||
defaults["browserArgs"] = []
|
defaults["browserArgs"] = []
|
||||||
|
|
||||||
self.add_option("--leak-threshold",
|
self.add_option("--leak-threshold",
|
||||||
action = "store", type = "int", dest = "leakThreshold",
|
action = "store", type = "int",
|
||||||
|
dest = "leakThreshold", metavar = "THRESHOLD",
|
||||||
help = "fail if the number of bytes leaked through "
|
help = "fail if the number of bytes leaked through "
|
||||||
"refcounted objects (or bytes in classes with "
|
"refcounted objects (or bytes in classes with "
|
||||||
"MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) is greater "
|
"MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) is greater "
|
||||||
@ -174,12 +182,9 @@ class MochitestOptions(optparse.OptionParser):
|
|||||||
usage = """\
|
usage = """\
|
||||||
Usage instructions for runtests.py.
|
Usage instructions for runtests.py.
|
||||||
All arguments are optional.
|
All arguments are optional.
|
||||||
If --log-file is specified, --file-level must be specified as well.
|
|
||||||
If --chrome is specified, chrome tests will be run instead of web content tests.
|
If --chrome is specified, chrome tests will be run instead of web content tests.
|
||||||
If --browser-chrome is specified, browser-chrome tests will be run instead of web content tests.
|
If --browser-chrome is specified, browser-chrome tests will be run instead of web content tests.
|
||||||
Logging levels are one of %s.
|
See <http://mochikit.com/doc/html/MochiKit/Logging.html> for details on the logging levels."""
|
||||||
For further details on the logging levels, see
|
|
||||||
<http://mochikit.com/doc/html/MochiKit/Logging.html>.""" % ", ".join(LOG_LEVELS)
|
|
||||||
self.set_usage(usage)
|
self.set_usage(usage)
|
||||||
|
|
||||||
|
|
||||||
@ -320,7 +325,6 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
|
|||||||
urlOpts.append("closeWhenDone=1")
|
urlOpts.append("closeWhenDone=1")
|
||||||
if options.logFile:
|
if options.logFile:
|
||||||
urlOpts.append("logFile=" + encodeURIComponent(options.logFile))
|
urlOpts.append("logFile=" + encodeURIComponent(options.logFile))
|
||||||
if options.fileLevel:
|
|
||||||
urlOpts.append("fileLevel=" + encodeURIComponent(options.fileLevel))
|
urlOpts.append("fileLevel=" + encodeURIComponent(options.fileLevel))
|
||||||
if options.consoleLevel:
|
if options.consoleLevel:
|
||||||
urlOpts.append("consoleLevel=" + encodeURIComponent(options.consoleLevel))
|
urlOpts.append("consoleLevel=" + encodeURIComponent(options.consoleLevel))
|
||||||
|
Loading…
Reference in New Issue
Block a user