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.
This commit is contained in:
Andrew Halberstadt 2014-10-20 08:55:28 -04:00
parent f56a5e24e7
commit 53480b6de0

View File

@ -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)