From 2ce21ee4288c0acc548327ed670f795c96c3e244 Mon Sep 17 00:00:00 2001 From: Nazma Panjwani Date: Wed, 19 Nov 2014 12:31:45 -0800 Subject: [PATCH] Bug 1091280 - moved options from AutomationUtils.addCommonOptions to runreftest.py, mochitest_options.py, runxpcshelltests.py and removed the addCommonOptions from automationUtils and automation.py.in, r=ahal --- build/automation.py.in | 10 --------- build/automationutils.py | 25 --------------------- layout/tools/reftest/runreftest.py | 23 ++++++++++++++++--- testing/mochitest/mochitest_options.py | 31 ++++++++++++++++++++++++-- testing/xpcshell/runxpcshelltests.py | 23 ++++++++++++++++--- 5 files changed, 69 insertions(+), 43 deletions(-) diff --git a/build/automation.py.in b/build/automation.py.in index b2a214e6f8f..2fe35d84443 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -181,7 +181,6 @@ class Automation(object): "log", "runApp", "Process", - "addCommonOptions", "initializeProfile", "DIST_BIN", "DEFAULT_APP", @@ -385,15 +384,6 @@ class Automation(object): proxy=proxy) return profile - def addCommonOptions(self, parser): - "Adds command-line options which are common to mochitest and reftest." - - parser.add_option("--setpref", - action = "append", type = "string", - default = [], - dest = "extraPrefs", metavar = "PREF=VALUE", - help = "defines an extra user preference") - def fillCertificateDB(self, profileDir, certPath, utilityPath, xrePath): pwfilePath = os.path.join(profileDir, ".crtdbpw") pwfile = open(pwfilePath, "w") diff --git a/build/automationutils.py b/build/automationutils.py index 2ddaf2ecb05..bbcc1f422ff 100644 --- a/build/automationutils.py +++ b/build/automationutils.py @@ -18,7 +18,6 @@ import mozinfo __all__ = [ "ZipFileReader", - "addCommonOptions", "dumpLeakLog", "processLeakLog", 'systemMemory', @@ -140,30 +139,6 @@ def printstatus(status, name = ""): # This is probably a can't-happen condition on Unix, but let's be defensive print "TEST-INFO | %s: undecodable exit status %04x\n" % (name, status) -def addCommonOptions(parser, defaults={}): - parser.add_option("--xre-path", - action = "store", type = "string", dest = "xrePath", - # individual scripts will set a sane default - default = None, - help = "absolute path to directory containing XRE (probably xulrunner)") - if 'SYMBOLS_PATH' not in defaults: - defaults['SYMBOLS_PATH'] = None - parser.add_option("--symbols-path", - action = "store", type = "string", dest = "symbolsPath", - default = defaults['SYMBOLS_PATH'], - help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols") - parser.add_option("--debugger", - action = "store", dest = "debugger", - help = "use the given debugger to launch the application") - parser.add_option("--debugger-args", - action = "store", dest = "debuggerArgs", - help = "pass the given args to the debugger _before_ " - "the application on the command line") - parser.add_option("--debugger-interactive", - action = "store_true", dest = "debuggerInteractive", - help = "prevents the test harness from redirecting " - "stdout and stderr for interactive debuggers") - def dumpLeakLog(leakLogFile, filter = False): """Process the leak log, without parsing it. diff --git a/layout/tools/reftest/runreftest.py b/layout/tools/reftest/runreftest.py index 1097802c6a0..00dac3613bf 100644 --- a/layout/tools/reftest/runreftest.py +++ b/layout/tools/reftest/runreftest.py @@ -22,7 +22,6 @@ SCRIPT_DIRECTORY = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0]) sys.path.insert(0, SCRIPT_DIRECTORY) from automationutils import ( - addCommonOptions, dumpScreen, environment, processLeakLog @@ -618,8 +617,26 @@ class ReftestOptions(OptionParser): def __init__(self): OptionParser.__init__(self) defaults = {} - addCommonOptions(self) - + self.add_option("--xre-path", + action = "store", type = "string", dest = "xrePath", + # individual scripts will set a sane default + default = None, + help = "absolute path to directory containing XRE (probably xulrunner)") + self.add_option("--symbols-path", + action = "store", type = "string", dest = "symbolsPath", + default = None, + help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols") + self.add_option("--debugger", + action = "store", dest = "debugger", + help = "use the given debugger to launch the application") + self.add_option("--debugger-args", + action = "store", dest = "debuggerArgs", + help = "pass the given args to the debugger _before_ " + "the application on the command line") + self.add_option("--debugger-interactive", + action = "store_true", dest = "debuggerInteractive", + help = "prevents the test harness from redirecting " + "stdout and stderr for interactive debuggers") self.add_option("--appname", action = "store", type = "string", dest = "app", help = "absolute path to application, overriding default") diff --git a/testing/mochitest/mochitest_options.py b/testing/mochitest/mochitest_options.py index 0e92cabad46..5120c014dcd 100644 --- a/testing/mochitest/mochitest_options.py +++ b/testing/mochitest/mochitest_options.py @@ -9,7 +9,6 @@ import optparse import os import tempfile -from automationutils import addCommonOptions from mozprofile import DEFAULT_PORTS here = os.path.abspath(os.path.dirname(__file__)) @@ -435,6 +434,35 @@ class MochitestOptions(optparse.OptionParser): "dest": "gmp_path", "help": "Path to fake GMP plugin. Will be deduced from the binary if not passed.", }], + [["--xre-path"], + { "action": "store", + "type": "string", + "dest": "xrePath", + "default": None, # individual scripts will set a sane default + "help": "absolute path to directory containing XRE (probably xulrunner)", + }], + [["--symbols-path"], + { "action": "store", + "type": "string", + "dest": "symbolsPath", + "default": None, + "help": "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols", + }], + [["--debugger"], + { "action": "store", + "dest": "debugger", + "help": "use the given debugger to launch the application", + }], + [["--debugger-args"], + { "action": "store", + "dest": "debuggerArgs", + "help": "pass the given args to the debugger _before_ the application on the command line", + }], + [["--debugger-interactive"], + { "action": "store_true", + "dest": "debuggerInteractive", + "help": "prevents the test harness from redirecting stdout and stderr for interactive debuggers", + }], ] def __init__(self, **kwargs): @@ -446,7 +474,6 @@ class MochitestOptions(optparse.OptionParser): if "default" in value and isinstance(value["default"], list): value["default"] = [] self.add_option(*option, **value) - addCommonOptions(self) self.set_usage(self.__doc__) def verifyOptions(self, options, mochitest): diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index a3096f83543..be5df7a311b 100755 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -39,7 +39,6 @@ except ImportError: HAVE_PSUTIL = False from automation import Automation -from automationutils import addCommonOptions HARNESS_TIMEOUT = 5 * 60 @@ -1359,8 +1358,6 @@ class XPCShellOptions(OptionParser): def __init__(self): """Process command line arguments and call runTests() to do the real work.""" OptionParser.__init__(self) - - addCommonOptions(self) self.add_option("--app-path", type="string", dest="appPath", default=None, help="application directory (as opposed to XRE directory)") @@ -1417,6 +1414,26 @@ class XPCShellOptions(OptionParser): self.add_option("--failure-manifest", dest="failureManifest", action="store", help="path to file where failure manifest will be written.") + self.add_option("--xre-path", + action = "store", type = "string", dest = "xrePath", + # individual scripts will set a sane default + default = None, + help = "absolute path to directory containing XRE (probably xulrunner)") + self.add_option("--symbols-path", + action = "store", type = "string", dest = "symbolsPath", + default = None, + help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols") + self.add_option("--debugger", + action = "store", dest = "debugger", + help = "use the given debugger to launch the application") + self.add_option("--debugger-args", + action = "store", dest = "debuggerArgs", + help = "pass the given args to the debugger _before_ " + "the application on the command line") + self.add_option("--debugger-interactive", + action = "store_true", dest = "debuggerInteractive", + help = "prevents the test harness from redirecting " + "stdout and stderr for interactive debuggers") def main(): parser = XPCShellOptions()