Bug 1492601 - Use MachCommandCondition.is_firefox_or_android, r=ahal.
authorBob Clary <bclary@bclary.com>
Sun, 23 Sep 2018 15:08:56 -0700
changeset 493577 62e67132c42941751b4817adc3ba6ff95ecd1678
parent 493576 1ee87961e2378a36a2862443e579f532a8a9ce25
child 493578 2c7157d3325f96328a0990ba3593c49a7554e309
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1492601
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1492601 - Use MachCommandCondition.is_firefox_or_android, r=ahal.
testing/marionette/mach_commands.py
testing/mozharness/mach_commands.py
testing/web-platform/mach_commands.py
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -16,21 +16,16 @@ from mach.decorators import (
 )
 
 from mozbuild.base import (
     MachCommandBase,
     MachCommandConditions as conditions,
 )
 
 
-def is_firefox_or_android(cls):
-    """Must have Firefox build or Android build."""
-    return conditions.is_firefox(cls) or conditions.is_android(cls)
-
-
 def create_parser_tests():
     from marionette_harness.runtests import MarionetteArguments
     from mozlog.structured import commandline
     parser = MarionetteArguments()
     commandline.add_logging_group(parser)
     return parser
 
 
@@ -69,17 +64,17 @@ def run_marionette(tests, binary=None, t
         return 0
 
 
 @CommandProvider
 class MarionetteTest(MachCommandBase):
     @Command("marionette-test",
              category="testing",
              description="Remote control protocol to Gecko, used for functional UI tests and browser automation.",
-             conditions=[is_firefox_or_android],
+             conditions=[conditions.is_firefox_or_android],
              parser=create_parser_tests,
              )
     def 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"]
@@ -94,17 +89,17 @@ class Marionette(MachCommandBase):
 
     @property
     def srcdir(self):
         return os.path.join(self.topsrcdir, "testing/marionette")
 
     @Command("marionette",
              category="misc",
              description="Remote control protocol to Gecko, used for functional UI tests and browser automation.",
-             conditions=[is_firefox_or_android],
+             conditions=[conditions.is_firefox_or_android],
              )
     def marionette(self):
         self.parser.print_usage()
         return 1
 
     @SubCommand("marionette", "test",
                 description="Run browser automation tests based on Marionette harness.",
                 parser=create_parser_tests,
--- a/testing/mozharness/mach_commands.py
+++ b/testing/mozharness/mach_commands.py
@@ -178,13 +178,13 @@ class MozharnessRunner(MozbuildObject):
         rv = subprocess.call(cmd, cwd=os.path.dirname(script))
         return rv
 
 
 @CommandProvider
 class MozharnessCommands(MachCommandBase):
     @Command('mozharness', category='testing',
              description='Run tests using mozharness.',
-             conditions=[conditions.is_firefox],
+             conditions=[conditions.is_firefox_or_android],
              parser=get_parser)
     def mozharness(self, **kwargs):
         runner = self._spawn(MozharnessRunner)
         return runner.run_suite(kwargs.pop("suite_name")[0], **kwargs)
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -18,21 +18,16 @@ from mozbuild.base import (
 from mach.decorators import (
     CommandProvider,
     Command,
 )
 
 from mach_commands_base import WebPlatformTestsRunner, create_parser_wpt
 
 
-def is_firefox_or_android(cls):
-    """Must have Firefox build or Android build."""
-    return conditions.is_firefox(cls) or conditions.is_android(cls)
-
-
 class WebPlatformTestsRunnerSetup(MozbuildObject):
     default_log_type = "mach"
 
     def kwargs_common(self, kwargs):
         build_path = os.path.join(self.topobjdir, 'build')
         here = os.path.split(__file__)[0]
         tests_src_path = os.path.join(here, "tests")
         if build_path not in sys.path:
@@ -353,17 +348,17 @@ def create_parser_manifest_download():
 
 @CommandProvider
 class MachCommands(MachCommandBase):
     def setup(self):
         self._activate_virtualenv()
 
     @Command("web-platform-tests",
              category="testing",
-             conditions=[is_firefox_or_android],
+             conditions=[conditions.is_firefox_or_android],
              parser=create_parser_wpt)
     def run_web_platform_tests(self, **params):
         self.setup()
         if conditions.is_android(self) and params["product"] != "fennec":
             if params["product"] is None:
                 params["product"] = "fennec"
             else:
                 raise ValueError("Must specify --product=fennec in Android environment.")
@@ -375,17 +370,17 @@ class MachCommands(MachCommandBase):
         self.wpt_manifest_download(**params)
         params["manifest_update"] = False
         wpt_setup = self._spawn(WebPlatformTestsRunnerSetup)
         wpt_runner = WebPlatformTestsRunner(wpt_setup)
         return wpt_runner.run(**params)
 
     @Command("wpt",
              category="testing",
-             conditions=[is_firefox_or_android],
+             conditions=[conditions.is_firefox_or_android],
              parser=create_parser_wpt)
     def run_wpt(self, **params):
         return self.run_web_platform_tests(**params)
 
     @Command("web-platform-tests-update",
              category="testing",
              parser=create_parser_update)
     def update_web_platform_tests(self, **params):