Commit 62407a87 authored by James Graham's avatar James Graham
Browse files

Bug 1390896 - Make mach wpt compatible with latest upstream, r=maja_zf

Upstream wpt changed from having a wptrun script to a wpt script with
a run subcommand. This involved some internal movement of code which
broke the `mach wpt` command when used with a non-firefox
product. This commit changes the mach integration to be compatible
with the new upstream API.

MozReview-Commit-ID: 1hvmZedNHSX

--HG--
extra : rebase_source : decd24551c2c5eaaae21eb64c7c376110b3de5b7
parent 623ddc7d
Loading
Loading
Loading
Loading
+14 −23
Original line number Diff line number Diff line
@@ -73,34 +73,16 @@ class WebPlatformTestsRunnerSetup(MozbuildObject):

        kwargs = wptcommandline.check_args(kwargs)

        return kwargs

    def kwargs_wptrun(self, kwargs):
        from wptrunner import wptcommandline
        here = os.path.join(self.topsrcdir, 'testing', 'web-platform')

        sys.path.insert(0, os.path.join(here, "tests", "tools"))

        import wptrun

        product = kwargs["product"]

        setup_func = {
            "chrome": wptrun.setup_chrome,
            "edge": wptrun.setup_edge,
            "servo": wptrun.setup_servo,
        }[product]

        try:
            wptrun.check_environ(product)

            setup_func(wptrun.virtualenv.Virtualenv(self.virtualenv_manager.virtualenv_root),
                       kwargs,
                       True)
        except wptrun.WptrunError as e:
            print(e.message, file=sys.stderr)
            sys.exit(1)

        kwargs["tests_root"] = os.path.join(here, "tests")

        sys.path.insert(0, kwargs["tests_root"])

        if kwargs["metadata_root"] is None:
            metadir = os.path.join(here, "products", kwargs["product"])
            if not os.path.exists(metadir):
@@ -114,7 +96,16 @@ class WebPlatformTestsRunnerSetup(MozbuildObject):
            with open(src_manifest) as src, open(dest_manifest, "w") as dest:
                dest.write(src.read())

        kwargs = wptcommandline.check_args(kwargs)
        from tools.wpt import run

        try:
            kwargs = run.setup_wptrunner(run.virtualenv.Virtualenv(self.virtualenv_manager.virtualenv_root),
                                         **kwargs)
        except run.WptrunError as e:
            print(e.message, file=sys.stderr)
            sys.exit(1)

        return kwargs

    def setup_fonts_firefox(self):
        # Ensure the Ahem font is available
+2 −2
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@ class WebPlatformTestsRunner(object):
    def run(self, **kwargs):
        from wptrunner import wptrunner
        if kwargs["product"] in ["firefox", None]:
            self.setup.kwargs_firefox(kwargs)
            kwargs = self.setup.kwargs_firefox(kwargs)
        elif kwargs["product"] in ("chrome", "edge", "servo"):
            self.setup.kwargs_wptrun(kwargs)
            kwargs = self.setup.kwargs_wptrun(kwargs)
        else:
            raise ValueError("Unknown product %s" % kwargs["product"])
        logger = wptrunner.setup_logging(kwargs, {self.setup.default_log_type: sys.stdout})