Bug 1386496 - Ahem.ttf is broken on web-platform-tests. r?jgraham draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 02 Aug 2017 12:35:53 +0900
changeset 619531 a1a8c055f8dab270d9edf2a9fe96c852b69f512b
parent 619442 fec8d72590053c3ad72cd3492d389213dfabc2ff
child 619532 6f0e9ee2397198627a613d8e4ec846915bae4988
push id71702
push userbmo:m_kato@ga2.so-net.ne.jp
push dateWed, 02 Aug 2017 06:12:50 +0000
reviewersjgraham
bugs1386496
milestone56.0a1
Bug 1386496 - Ahem.ttf is broken on web-platform-tests. r?jgraham Ahem.ttf is copied to $(DIST)/bin/firefox/fonts, but this file is broken due to text mode copy. So we should use binary mode instead. MozReview-Commit-ID: KP7yNyPiejU
testing/mozharness/scripts/web_platform_tests.py
testing/web-platform/mach_commands.py
--- a/testing/mozharness/scripts/web_platform_tests.py
+++ b/testing/mozharness/scripts/web_platform_tests.py
@@ -237,17 +237,17 @@ class WebPlatformTest(TestingMixin, Merc
         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:
+        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()
         cmd = self._query_cmd()
 
         self._install_fonts()
 
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -120,17 +120,17 @@ class WebPlatformTestsRunnerSetup(Mozbui
         # 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:
+            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 run_update(self, **kwargs):
         import update