From 53480b6de07ce356971aba3c44dbea62b7a422f4 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Mon, 20 Oct 2014 08:55:28 -0400 Subject: [PATCH] Bug 1084587 - Add --profile to |mach marionette-test|, r=jgriffin, DONTBUILD, a=NPOTB Note: This also refactors the entry points a bit to automatically pass through **kwargs instead of needing to explicitly list each parameter in about three different locations. --- testing/marionette/mach_commands.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/testing/marionette/mach_commands.py b/testing/marionette/mach_commands.py index 0252d17be21..574078f0c1a 100644 --- a/testing/marionette/mach_commands.py +++ b/testing/marionette/mach_commands.py @@ -61,7 +61,6 @@ def run_marionette(tests, b2g_path=None, emulator=None, testtype=None, tests = [os.path.join(topsrcdir, 'testing/marionette/client/marionette/tests/unit-tests.ini')] - options.type = testtype if b2g_path: options.homedir = b2g_path if emulator: @@ -70,7 +69,8 @@ def run_marionette(tests, b2g_path=None, emulator=None, testtype=None, options.binary = binary path, exe = os.path.split(options.binary) - options.address = address + for k, v in kwargs.iteritems(): + setattr(options, k, v) parser.verify_usage(options, tests) @@ -94,12 +94,12 @@ class B2GCommands(MachCommandBase): @Command('marionette-webapi', category='testing', description='Run a Marionette webapi test (test WebAPIs using marionette).', conditions=[conditions.is_b2g]) - @CommandArgument('--type', dest='testtype', - help='Test type, usually one of: browser, b2g, b2g-qemu.', - default='b2g') + @CommandArgument('--type', + default='b2g', + help='Test type, usually one of: browser, b2g, b2g-qemu.') @CommandArgument('tests', nargs='*', metavar='TESTS', help='Path to test(s) to run.') - def run_marionette_webapi(self, tests, testtype=None): + def run_marionette_webapi(self, tests, **kwargs): emulator = None if self.device_name: if self.device_name.startswith('emulator'): @@ -112,7 +112,7 @@ class B2GCommands(MachCommandBase): return 1 return run_marionette(tests, b2g_path=self.b2g_home, emulator=emulator, - testtype=testtype, topsrcdir=self.topsrcdir, address=None) + topsrcdir=self.topsrcdir, **kwargs) @CommandProvider class MachCommands(MachCommandBase): @@ -123,13 +123,13 @@ class MachCommands(MachCommandBase): ) @CommandArgument('--address', help='host:port of running Gecko instance to connect to.') - @CommandArgument('--type', dest='testtype', - help='Test type, usually one of: browser, b2g, b2g-qemu.', - default='browser') + @CommandArgument('--type', + default='browser', + help='Test type, usually one of: browser, b2g, b2g-qemu.') + @CommandArgument('--profile', + help='Path to gecko profile to use.') @CommandArgument('tests', nargs='*', metavar='TESTS', help='Path to test(s) to run.') - def run_marionette_test(self, tests, address=None, testtype=None, - **kwargs): + def run_marionette_test(self, tests, **kwargs): binary = self.get_binary_path('app') - return run_marionette(tests, binary=binary, testtype=testtype, - topsrcdir=self.topsrcdir, address=address) + return run_marionette(tests, binary=binary, topsrcdir=self.topsrcdir, **kwargs)