Bug 787203 - Allow mach marionette-test to run with android build; r?AutomatedTester draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Tue, 05 Jul 2016 14:09:33 -0400
changeset 384166 e85c5bd226497e542a8009dd6979ffe540c95b25
parent 384165 8a46ec066ec3223ec3d9aa60ddcadb00772180e9
child 524626 6398c8ac225f929600ac7d0f76ace3ea3abc6526
push id22185
push usermjzffr@gmail.com
push dateTue, 05 Jul 2016 18:12:09 +0000
reviewersAutomatedTester
bugs787203
milestone50.0a1
Bug 787203 - Allow mach marionette-test to run with android build; r?AutomatedTester MozReview-Commit-ID: KHuXrywXBWq
testing/marionette/mach_commands.py
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -14,22 +14,25 @@ from mozbuild.base import (
 )
 
 from mach.decorators import (
     CommandArgument,
     CommandProvider,
     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()
 
-def run_marionette(tests, testtype=None, address=None, binary=None, topsrcdir=None, **kwargs):
+def run_marionette(tests, binary=None, topsrcdir=None, **kwargs):
     from mozlog.structured import commandline
 
     from marionette.runtests import (
         MarionetteTestRunner,
         BaseMarionetteArguments,
         MarionetteHarness
     )
 
@@ -37,17 +40,16 @@ def run_marionette(tests, testtype=None,
     commandline.add_logging_group(parser)
 
     if not tests:
         tests = [os.path.join(topsrcdir,
                  'testing/marionette/harness/marionette/tests/unit-tests.ini')]
 
     args = argparse.Namespace(tests=tests)
 
-    args.address = address
     args.binary = binary
 
     for k, v in kwargs.iteritems():
         setattr(args, k, v)
 
     parser.verify_usage(args)
 
     args.logger = commandline.setup_logging("Marionette Unit Tests",
@@ -133,30 +135,31 @@ class B2GCommands(MachCommandBase):
 
         return run_marionette(tests, b2g_path=self.b2g_home, emulator=emulator,
             topsrcdir=self.topsrcdir, **kwargs)
 
 @CommandProvider
 class MachCommands(MachCommandBase):
     @Command('marionette-test', category='testing',
         description='Run a Marionette test (Check UI or the internal JavaScript using marionette).',
-        conditions=[conditions.is_firefox],
+        conditions=[is_firefox_or_android],
         parser=setup_marionette_argument_parser,
     )
     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']
 
-        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
+        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):