Bug 1287594 - Allow usage of marionette harness options through mach. r=automatedtester

MozReview-Commit-ID: j3bWigyRPG

--HG--
extra : rebase_source : 34c7375905466e9ceef0b309b724bde5e31575d6
This commit is contained in:
clui 2016-07-26 21:52:42 -07:00
Родитель 797aa910b7
Коммит 17a75a8e03
2 изменённых файлов: 16 добавлений и 11 удалений

Просмотреть файл

@ -77,6 +77,8 @@ def mach_parsed_kwargs(logger):
'avd': None,
'avd_home': None,
'binary': u'/path/to/firefox',
'browsermob_port' : None,
'browsermob_script' : None,
'device_serial': None,
'e10s': True,
'emulator': False,
@ -622,4 +624,4 @@ def test_catch_invalid_test_names(runner):
if __name__ == '__main__':
import sys
sys.exit(pytest.main(['--verbose', __file__]))
sys.exit(pytest.main(['--verbose', __file__]))

Просмотреть файл

@ -24,20 +24,21 @@ def is_firefox_or_android(cls):
return conditions.is_firefox(cls) or conditions.is_android(cls)
def setup_marionette_argument_parser():
from marionette.runner.base import BaseMarionetteArguments
return BaseMarionetteArguments()
from marionette.runtests import MarionetteArguments
from mozlog.structured import commandline
parser = MarionetteArguments()
commandline.add_logging_group(parser)
return parser
def run_marionette(tests, binary=None, topsrcdir=None, **kwargs):
from mozlog.structured import commandline
from marionette.runtests import (
MarionetteTestRunner,
BaseMarionetteArguments,
MarionetteHarness
)
parser = BaseMarionetteArguments()
commandline.add_logging_group(parser)
parser = setup_marionette_argument_parser()
if not tests:
tests = [os.path.join(topsrcdir,
@ -150,8 +151,11 @@ class MachCommands(MachCommandBase):
tests.append(obj['file_relpath'])
del kwargs['test_objects']
if not kwargs.get('binary') and conditions.is_firefox(self):
kwargs['binary'] = self.get_binary_path('app')
if conditions.is_firefox(self):
bin_path = self.get_binary_path('app')
if kwargs.get('binary') is not None:
print "Warning: ignoring '--binary' option, using binary at " + bin_path
kwargs['binary'] = bin_path
return run_marionette(tests, topsrcdir=self.topsrcdir, **kwargs)
@Command('session-test', category='testing',
@ -166,6 +170,5 @@ class MachCommands(MachCommandBase):
tests.append(obj['file_relpath'])
del kwargs['test_objects']
if not kwargs.get('binary') and conditions.is_firefox(self):
kwargs['binary'] = self.get_binary_path('app')
return run_session(tests, topsrcdir=self.topsrcdir, **kwargs)
kwargs['binary'] = self.get_binary_path('app')
return run_session(tests, topsrcdir=self.topsrcdir, **kwargs)