Bug 1305795 - Support downloading mozinfo.json from an artifact; r?ted draft
authorGregory Szorc <gps@mozilla.com>
Wed, 28 Sep 2016 10:58:55 -0700
changeset 418564 08a554e6d9a605d99bb04959c4041f8ca9c4f1ea
parent 418563 c62c9fb642e1e365e4951b39ecb76d48b15f1164
child 418565 bf8c6e6818bdebf666cf231252f73906397abc1b
push id30707
push userbmo:gps@mozilla.com
push dateWed, 28 Sep 2016 18:02:51 +0000
reviewersted
bugs1305795
milestone52.0a1
Bug 1305795 - Support downloading mozinfo.json from an artifact; r?ted TestingMixin.download_and_extract() has been taught to download mozinfo.json from an artifact (as opposed to extracting it from a zip file as a side-effect). The WPT script has been converted to obtain mozinfo.json this way. We now only rely on common.tests.zip for bin/* files in the WPT script. MozReview-Commit-ID: 4rTioEPkAby
testing/mozharness/mozharness/mozilla/testing/testbase.py
testing/mozharness/scripts/web_platform_tests.py
--- a/testing/mozharness/mozharness/mozilla/testing/testbase.py
+++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py
@@ -583,17 +583,18 @@ 2. running via buildbot and running the 
             return
         if not self.symbols_path:
             self.symbols_path = os.path.join(dirs['abs_work_dir'], 'symbols')
 
         self.set_buildbot_property("symbols_url", self.symbols_url,
                                    write_to_file=True)
         self.download_unpack(self.symbols_url, self.symbols_path)
 
-    def download_and_extract(self, extract_dirs=None, suite_categories=None):
+    def download_and_extract(self, extract_dirs=None, suite_categories=None,
+                             download_mozinfo=False):
         """
         download and extract test zip / download installer
         """
         # Swap plain http for https when we're downloading from ftp
         # See bug 957502 and friends
         from_ = "http://ftp.mozilla.org"
         to_ = "https://ftp-ssl.mozilla.org"
         for attr in 'symbols_url', 'installer_url', 'test_packages_url', 'test_url', 'mozinfo_json_url':
@@ -622,16 +623,24 @@ 2. running via buildbot and running the 
 
             suite_categories = suite_categories or ['common']
             self._download_test_packages(suite_categories, extract_dirs)
 
         self._download_installer()
         if self.config.get('download_symbols'):
             self._download_and_extract_symbols()
 
+        if download_mozinfo:
+            if not getattr(self, 'mozinfo_json_url', None):
+                self.fatal('mozinfo_json_url required but not found')
+
+            dirs = self.query_abs_dirs()
+            self.download_file(self.mozinfo_json_url,
+                               os.path.join(dirs['abs_test_install_dir'], 'mozinfo.json'))
+
     # create_virtualenv is in VirtualenvMixin.
 
     def preflight_install(self):
         if not self.installer_path:
             if self.config.get('installer_path'):
                 self.installer_path = self.config['installer_path']
             else:
                 self.fatal("""installer_path isn't set!
--- a/testing/mozharness/scripts/web_platform_tests.py
+++ b/testing/mozharness/scripts/web_platform_tests.py
@@ -177,19 +177,19 @@ class WebPlatformTest(TestingMixin, Merc
                                       str_format_values=str_format_values))
         cmd.extend(self.query_tests_args(try_tests,
                                          str_format_values=str_format_values))
 
         return cmd
 
     def download_and_extract(self):
         super(WebPlatformTest, self).download_and_extract(
-            extract_dirs=["bin/*",
-                          "mozinfo.json"],
-            suite_categories=["web-platform"])
+            extract_dirs=["bin/*"],
+            suite_categories=["web-platform"],
+            download_mozinfo=True)
 
     def run_tests(self):
         dirs = self.query_abs_dirs()
         cmd = self._query_cmd()
 
         parser = StructuredOutputParser(config=self.config,
                                         log_obj=self.log_obj,
                                         log_compact=True)