Bug 1500081 - Use --install-fonts to install fonts for wptrunner, r=AutomatedTester
authorJames Graham <james@hoppipolla.co.uk>
Thu, 11 Oct 2018 16:39:01 +0100
changeset 441965 1d7feb40277692c23edf72c421558d0177480256
parent 441964 d4de0eb65962f0aa404ac7e632d46a8f7f296557
child 441966 87a982cbe3319558d1c54d1b448316bd300411d5
push id34881
push usercsabou@mozilla.com
push dateThu, 18 Oct 2018 21:55:32 +0000
treeherdermozilla-central@c0c288dc283e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersAutomatedTester
bugs1500081
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 1500081 - Use --install-fonts to install fonts for wptrunner, r=AutomatedTester This replaces a previous Firefox-only method except on Windows 7 where it seems that we have some issues with the registry. Differential Revision: https://phabricator.services.mozilla.com/D9091
testing/mozharness/scripts/web_platform_tests.py
testing/web-platform/mach_commands.py
testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
--- a/testing/mozharness/scripts/web_platform_tests.py
+++ b/testing/mozharness/scripts/web_platform_tests.py
@@ -228,16 +228,22 @@ class WebPlatformTest(TestingMixin, Merc
 
         if self.is_android:
             cmd += ["--device-serial=%s" % self.device_serial]
             cmd += ["--package-name=%s" % self.query_package_name()]
 
         if sys.platform == "darwin":
             cmd += ["--exclude=css"]
 
+        if mozinfo.info["os"] == "win" and mozinfo.info["os_version"] == "6.1":
+            # On Windows 7 --install-fonts fails, so fall back to a Firefox-specific codepath
+            self._install_fonts()
+        else:
+            cmd += ["--install-fonts"]
+
         for test_type in test_types:
             cmd.append("--test-type=%s" % test_type)
 
         if c['extra_prefs']:
             cmd.extend(['--setpref={}'.format(p) for p in c['extra_prefs']])
 
         if not c["e10s"]:
             cmd.append("--disable-e10s")
@@ -324,18 +330,16 @@ class WebPlatformTest(TestingMixin, Merc
         ahem_src = os.path.join(dirs["abs_wpttest_dir"], "tests", "fonts", "Ahem.ttf")
         ahem_dest = os.path.join(font_path, "Ahem.ttf")
         with open(ahem_src, "rb") as src, open(ahem_dest, "wb") as dest:
             dest.write(src.read())
 
     def run_tests(self):
         dirs = self.query_abs_dirs()
 
-        self._install_fonts()
-
         parser = StructuredOutputParser(config=self.config,
                                         log_obj=self.log_obj,
                                         log_compact=True,
                                         error_list=BaseErrorList + HarnessErrorList)
 
         env = {'MINIDUMP_SAVE_PATH': dirs['abs_blob_upload_dir']}
         env['RUST_BACKTRACE'] = 'full'
 
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -73,29 +73,35 @@ class WebPlatformTestsRunnerSetup(Mozbui
         if kwargs["log_mach_screenshot"] is None:
             kwargs["log_mach_screenshot"] = True
 
         kwargs["capture_stdio"] = True
 
         return kwargs
 
     def kwargs_firefox(self, kwargs):
+        import mozinfo
         from wptrunner import wptcommandline
         kwargs = self.kwargs_common(kwargs)
 
         if kwargs["binary"] is None:
             kwargs["binary"] = self.get_binary_path()
 
         if kwargs["certutil_binary"] is None:
             kwargs["certutil_binary"] = self.get_binary_path('certutil')
 
         if kwargs["webdriver_binary"] is None:
             kwargs["webdriver_binary"] = self.get_binary_path("geckodriver", validate_exists=False)
 
-        self.setup_fonts_firefox()
+
+        if mozinfo.info["os"] == "win" and mozinfo.info["os_version"] == "6.1":
+            # On Windows 7 --install-fonts fails, so fall back to a Firefox-specific codepath
+            self.setup_fonts_firefox()
+        else:
+            kwargs["install_fonts"] = True
 
         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')
@@ -136,16 +142,17 @@ class WebPlatformTestsRunnerSetup(Mozbui
             font_path = os.path.join(os.path.dirname(self.get_binary_path()), os.pardir, "Resources", "res", "fonts")
         ahem_src = os.path.join(self.topsrcdir, "testing", "web-platform", "tests", "fonts", "Ahem.ttf")
         ahem_dest = os.path.join(font_path, "Ahem.ttf")
         if not os.path.exists(ahem_dest) and os.path.exists(ahem_src):
             with open(ahem_src, "rb") as src, open(ahem_dest, "wb") as dest:
                 dest.write(src.read())
 
 
+
 class WebPlatformTestsUpdater(MozbuildObject):
     """Update web platform tests."""
     def setup_logging(self, **kwargs):
         import update
         return update.setup_logging(kwargs, {"mach": sys.stdout})
 
     def run_update(self, logger, **kwargs):
         import update
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
@@ -145,17 +145,17 @@ def run_tests(config, test_paths, produc
 
         env_extras = get_env_extras(**kwargs)
 
         check_args(**kwargs)
 
         if kwargs["install_fonts"]:
             env_extras.append(FontInstaller(
                 font_dir=kwargs["font_dir"],
-                ahem=os.path.join(kwargs["tests_root"], "fonts/Ahem.ttf")
+                ahem=os.path.join(test_paths["/"]["tests_path"], "fonts/Ahem.ttf")
             ))
 
         run_info, test_loader = get_loader(test_paths,
                                            product,
                                            run_info_extras=run_info_extras(**kwargs),
                                            **kwargs)
 
         test_source_kwargs = {"processes": kwargs["processes"]}