Bug 1363428 - Copy the Ahem font into the bundled font directory, r=maja_zf
MozReview-Commit-ID: 3VgrawYWoWp
--- a/testing/mozharness/scripts/web_platform_tests.py
+++ b/testing/mozharness/scripts/web_platform_tests.py
@@ -211,20 +211,37 @@ class WebPlatformTest(TestingMixin, Merc
"bin/*",
"config/*",
"mozbase/*",
"marionette/*",
"tools/*",
"web-platform/*"],
suite_categories=["web-platform"])
+ def _install_fonts(self):
+ # Ensure the Ahem font is available
+ dirs = self.query_abs_dirs()
+
+ if not sys.platform.startswith("darwin"):
+ font_path = os.path.join(os.path.dirname(self.binary_path), "fonts")
+ else:
+ font_path = os.path.join(os.path.dirname(self.binary_path), os.pardir, "Resources", "res", "fonts")
+ if not os.path.exists(font_path):
+ os.makedirs(font_path)
+ 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) as src, open(ahem_dest, "w") as dest:
+ dest.write(src.read())
+
def run_tests(self):
dirs = self.query_abs_dirs()
cmd = self._query_cmd()
+ 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'] = '1'
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -61,16 +61,18 @@ class WebPlatformTestsRunnerSetup(Mozbui
if kwargs["host_cert_path"] is None:
kwargs["host_cert_path"] = os.path.join(here, "certs", "web-platform.test.pem")
kwargs["capture_stdio"] = True
if kwargs["webdriver_binary"] is None:
kwargs["webdriver_binary"] = self.get_binary_path("geckodriver", validate_exists=False)
+ self.setup_fonts_firefox()
+
kwargs = wptcommandline.check_args(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"))
@@ -106,16 +108,29 @@ class WebPlatformTestsRunnerSetup(Mozbui
dest_manifest = os.path.join(kwargs["metadata_root"], "MANIFEST.json")
if not os.path.exists(dest_manifest) and os.path.exists(src_manifest):
with open(src_manifest) as src, open(dest_manifest, "w") as dest:
dest.write(src.read())
kwargs = wptcommandline.check_args(kwargs)
+ def setup_fonts_firefox(self):
+ # Ensure the Ahem font is available
+ if not sys.platform.startswith("darwin"):
+ font_path = os.path.join(os.path.dirname(self.get_binary_path()), "fonts")
+ else:
+ 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) as src, open(ahem_dest, "w") as dest:
+ dest.write(src.read())
+
+
class WebPlatformTestsUpdater(MozbuildObject):
"""Update web platform tests."""
def run_update(self, **kwargs):
import update
from update import updatecommandline
if kwargs["config"] is None: