Bug 1287594 - Allow usage of marionette harness options through mach. r?automatedtester draft
authorclui <clui159@gmail.com>
Tue, 26 Jul 2016 21:52:42 -0700
changeset 403563 af1a158c2c6fc467f2aa88bc6b78d11c7dfde829
parent 403562 646321aa345ce4f43e40edf0b847153e2522fa8a
child 403564 9422a7e2425965e91679b6d74140181cff39e95a
child 403566 8f13e92eb0c26f0bf3628ca30a81a47bb1c893c9
push id26939
push userbmo:clui159@gmail.com
push dateFri, 19 Aug 2016 23:30:22 +0000
reviewersautomatedtester
bugs1287594
milestone51.0a1
Bug 1287594 - Allow usage of marionette harness options through mach. r?automatedtester MozReview-Commit-ID: j3bWigyRPG
testing/marionette/harness/marionette/tests/harness_unit/test_marionette_runner.py
testing/marionette/mach_commands.py
--- a/testing/marionette/harness/marionette/tests/harness_unit/test_marionette_runner.py
+++ b/testing/marionette/harness/marionette/tests/harness_unit/test_marionette_runner.py
@@ -72,16 +72,18 @@ def mach_parsed_kwargs(logger):
         'adb_path': None,
         'addon': None,
         'address': None,
         'app': None,
         'app_args': [],
         'avd': None,
         'avd_home': None,
         'binary': u'/path/to/firefox',
+        'browsermob_port' : None,
+        'browsermob_script' : None,
         'device_serial': None,
         'e10s': True,
         'emulator': False,
         'emulator_bin': None,
         'gecko_log': None,
         'jsdebugger': False,
         'log_errorsummary': None,
         'log_html': None,
@@ -477,9 +479,9 @@ def test_catch_invalid_test_names(runner
     for bad_name in bad_tests:
         assert bad_name in msg
     for good_name in good_tests:
         assert good_name not in msg
 
 
 if __name__ == '__main__':
     import sys
-    sys.exit(pytest.main(['--verbose', __file__]))
+    sys.exit(pytest.main(['--verbose', __file__]))
\ No newline at end of file
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -19,30 +19,31 @@ from mach.decorators import (
     Command,
 )
 
 def is_firefox_or_android(cls):
     """Must have Firefox build or Android build."""
     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,
                  'testing/marionette/harness/marionette/tests/unit-tests.ini')]
 
     args = argparse.Namespace(tests=tests)
 
     args.binary = binary
@@ -145,27 +146,29 @@ class MachCommands(MachCommandBase):
     )
     def run_marionette_test(self, tests, **kwargs):
         if 'test_objects' in kwargs:
             tests = []
             for obj in kwargs['test_objects']:
                 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',
         description='Run a Session test (Check Telemetry using marionette).',
         conditions=[conditions.is_firefox],
         parser=setup_session_argument_parser,
     )
     def run_session_test(self, tests, **kwargs):
         if 'test_objects' in kwargs:
             tests = []
             for obj in kwargs['test_objects']:
                 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)
\ No newline at end of file