From 577e34919de0780fd18aa71a0f01ceaf3b88b301 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Wed, 7 Aug 2013 11:46:25 -0400 Subject: [PATCH] Bug 887291 - Allow marionette test runner to pass command line arguments onto the application, r=jgriffin --- testing/marionette/client/marionette/geckoinstance.py | 5 +++-- testing/marionette/client/marionette/marionette.py | 5 ++--- testing/marionette/client/marionette/runtests.py | 11 +++++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/testing/marionette/client/marionette/geckoinstance.py b/testing/marionette/client/marionette/geckoinstance.py index 5f97db9f3c4..cbec3e67b29 100644 --- a/testing/marionette/client/marionette/geckoinstance.py +++ b/testing/marionette/client/marionette/geckoinstance.py @@ -18,11 +18,12 @@ class GeckoInstance(object): "browser.sessionstore.resume_from_crash": False, "browser.warnOnQuit": False} - def __init__(self, host, port, bin, profile): + def __init__(self, host, port, bin, profile, app_args=None): self.marionette_host = host self.marionette_port = port self.bin = bin self.profile = profile + self.app_args = app_args or [] self.runner = None def start(self): @@ -41,7 +42,7 @@ class GeckoInstance(object): self.runner = runner_class.create( binary=self.bin, profile_args=profile_args, - cmdargs=['-no-remote', '-marionette'], + cmdargs=['-no-remote', '-marionette'] + self.app_args, kp_kwargs={ 'processOutputLine': [NullOutput()], 'logfile': self.gecko_log}) diff --git a/testing/marionette/client/marionette/marionette.py b/testing/marionette/client/marionette/marionette.py index 8a9bcb80419..c70713ee931 100644 --- a/testing/marionette/client/marionette/marionette.py +++ b/testing/marionette/client/marionette/marionette.py @@ -198,14 +198,13 @@ class Marionette(object): TIMEOUT_SCRIPT = 'script' TIMEOUT_PAGE = 'page load' - def __init__(self, host='localhost', port=2828, app=None, bin=None, + def __init__(self, host='localhost', port=2828, app=None, app_args=None, bin=None, profile=None, emulator=None, sdcard=None, emulatorBinary=None, emulatorImg=None, emulator_res=None, gecko_path=None, connectToRunningEmulator=False, homedir=None, baseurl=None, noWindow=False, logcat_dir=None, busybox=None, symbols_path=None, timeout=None): self.host = host self.port = self.local_port = port - self.app = app self.bin = bin self.instance = None self.profile = profile @@ -236,7 +235,7 @@ class Marionette(object): else: instance_class = geckoinstance.GeckoInstance self.instance = instance_class(host=self.host, port=self.port, - bin=self.bin, profile=self.profile) + bin=self.bin, profile=self.profile, app_args=app_args) self.instance.start() assert(self.wait_for_port()) diff --git a/testing/marionette/client/marionette/runtests.py b/testing/marionette/client/marionette/runtests.py index 1bc1e34a847..d0bd9242599 100644 --- a/testing/marionette/client/marionette/runtests.py +++ b/testing/marionette/client/marionette/runtests.py @@ -210,8 +210,8 @@ class MarionetteTestRunner(object): def __init__(self, address=None, emulator=None, emulatorBinary=None, emulatorImg=None, emulator_res='480x800', homedir=None, - app=None, bin=None, profile=None, autolog=False, revision=None, - logger=None, testgroup="marionette", noWindow=False, + app=None, app_args=None, bin=None, profile=None, autolog=False, + revision=None, logger=None, testgroup="marionette", noWindow=False, logcat_dir=None, xml_output=None, repeat=0, gecko_path=None, testvars=None, tree=None, type=None, device_serial=None, symbols_path=None, timeout=None, es_servers=None, **kwargs): @@ -222,6 +222,7 @@ class MarionetteTestRunner(object): self.emulator_res = emulator_res self.homedir = homedir self.app = app + self.app_args = app_args or [] self.bin = bin self.profile = profile self.autolog = autolog @@ -327,6 +328,7 @@ class MarionetteTestRunner(object): self.marionette = Marionette(host=host, port=int(port), app=self.app, + app_args=self.app_args, bin=self.bin, profile=self.profile, baseurl=self.baseurl, @@ -696,6 +698,11 @@ class MarionetteTestOptions(OptionParser): dest='app', action='store', help='application to use') + self.add_option('--app-arg', + dest='app_args', + action='append', + default=[], + help='specify a command line argument to be passed onto the application') self.add_option('--binary', dest='bin', action='store',