Bug 1368264 - Make WPT use WebDriver binary from test archive draft
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 05 Jun 2017 16:05:19 +0100
changeset 589812 59f09d565b576ccb339ed83035dfa098d347485b
parent 589811 6038dbfd00100693aea880682567b33218164ddf
child 632026 407b8299c785ceb1444c7a10fa168ee19de6b143
push id62529
push userbmo:ato@mozilla.com
push dateTue, 06 Jun 2017 22:05:21 +0000
bugs1368264
milestone55.0a1
Bug 1368264 - Make WPT use WebDriver binary from test archive Instead of fetching geckodriver from tooltool, we ask mozharness to pick up the geckodriver binary from the common test archive. As it is packaged under /bin along with other test-relevant binaries such as wptserve, we can retrieve it from the abs_test_install_dir. It would also be possible to use ScriptMixin.query_exe for this purpose after specifying the binary in the "exes" section of the different mozharness configs, but this seems needlessly complicated. Because we also do not yet have geckodriver on all platforms, we only want to look for it if requested to run the wdspec test type. MozReview-Commit-ID: 7jLuBeDiQNE
testing/config/tooltool-manifests/linux64/geckodriver.manifest
testing/mozharness/scripts/web_platform_tests.py
deleted file mode 100644
--- a/testing/config/tooltool-manifests/linux64/geckodriver.manifest
+++ /dev/null
@@ -1,9 +0,0 @@
-[
-  {
-    "size": 2183421,
-    "visibility": "public",
-    "digest": "8e201c5f0f5494cc89b7caad509b2618b1f1b668ac8a81d56df2514968b62b4e06765e9a4e42b7fb273c94d1ca2a712446599654a04716aec204fa8e6a1cee5b",
-    "algorithm": "sha512",
-    "filename": "geckodriver-v0.16.1-linux64.tar.gz"
-  }
-]
--- a/testing/mozharness/scripts/web_platform_tests.py
+++ b/testing/mozharness/scripts/web_platform_tests.py
@@ -68,34 +68,32 @@ class WebPlatformTest(TestingMixin, Merc
 
     def __init__(self, require_config_file=True):
         super(WebPlatformTest, self).__init__(
             config_options=self.config_options,
             all_actions=[
                 'clobber',
                 'read-buildbot-config',
                 'download-and-extract',
-                'fetch-geckodriver',
                 'create-virtualenv',
                 'pull',
                 'install',
                 'run-tests',
             ],
             require_config_file=require_config_file,
             config={'require_test_zip': True})
 
         # Surely this should be in the superclass
         c = self.config
         self.installer_url = c.get('installer_url')
         self.test_url = c.get('test_url')
         self.test_packages_url = c.get('test_packages_url')
         self.installer_path = c.get('installer_path')
         self.binary_path = c.get('binary_path')
         self.abs_app_dir = None
-        self.geckodriver_path = None
 
     def query_abs_app_dir(self):
         """We can't set this in advance, because OSX install directories
         change depending on branding and opt/debug.
         """
         if self.abs_app_dir:
             return self.abs_app_dir
         if not self.binary_path:
@@ -106,16 +104,17 @@ class WebPlatformTest(TestingMixin, Merc
     def query_abs_dirs(self):
         if self.abs_dirs:
             return self.abs_dirs
         abs_dirs = super(WebPlatformTest, self).query_abs_dirs()
 
         dirs = {}
         dirs['abs_app_install_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'application')
         dirs['abs_test_install_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'tests')
+        dirs['abs_test_bin_dir'] = os.path.join(dirs['abs_test_install_dir'], 'bin')
         dirs["abs_wpttest_dir"] = os.path.join(dirs['abs_test_install_dir'], "web-platform")
         dirs['abs_blob_upload_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'blobber_upload_dir')
 
         abs_dirs.update(dirs)
         self.abs_dirs = abs_dirs
 
         return self.abs_dirs
 
@@ -166,18 +165,21 @@ class WebPlatformTest(TestingMixin, Merc
             cmd.append("--disable-e10s")
 
         for opt in ["total_chunks", "this_chunk"]:
             val = c.get(opt)
             if val:
                 cmd.append("--%s=%s" % (opt.replace("_", "-"), val))
 
         if "wdspec" in c.get("test_type", []):
-            assert self.geckodriver_path is not None
-            cmd.append("--webdriver-binary=%s" % self.geckodriver_path)
+            geckodriver_path = os.path.join(dirs["abs_test_bin_dir"], "geckodriver")
+            if not os.path.isfile(geckodriver_path):
+                self.fatal("Unable to find geckodriver binary "
+                           "in common test package: %s" % geckodriver_path)
+            cmd.append("--webdriver-binary=%s" % geckodriver_path)
 
         options = list(c.get("options", []))
 
         str_format_values = {
             'binary_path': self.binary_path,
             'test_path': dirs["abs_wpttest_dir"],
             'test_install_path': dirs["abs_test_install_dir"],
             'abs_app_dir': abs_app_dir,
@@ -199,53 +201,16 @@ class WebPlatformTest(TestingMixin, Merc
             extract_dirs=["bin/*",
                           "config/*",
                           "mozbase/*",
                           "marionette/*",
                           "tools/wptserve/*",
                           "web-platform/*"],
             suite_categories=["web-platform"])
 
-    def fetch_geckodriver(self):
-        c = self.config
-        dirs = self.query_abs_dirs()
-
-        platform_name = self.platform_name()
-
-        if "wdspec" not in c.get("test_type", []):
-            return
-
-        if platform_name != "linux64":
-            self.fatal("Don't have a geckodriver for %s" % platform_name)
-
-        tooltool_path = os.path.join(dirs["abs_test_install_dir"],
-                                     "config",
-                                     "tooltool-manifests",
-                                     TOOLTOOL_PLATFORM_DIR[platform_name],
-                                     "geckodriver.manifest")
-
-        with open(tooltool_path) as f:
-            manifest = json.load(f)
-
-        assert len(manifest) == 1
-        geckodriver_filename = manifest[0]["filename"]
-        assert geckodriver_filename.endswith(".tar.gz")
-
-        self.tooltool_fetch(
-            manifest=tooltool_path,
-            output_dir=dirs['abs_work_dir'],
-            cache=c.get('tooltool_cache')
-        )
-
-        compressed_path = os.path.join(dirs['abs_work_dir'], geckodriver_filename)
-        tar = self.query_exe('tar', return_type="list")
-        self.run_command(tar + ["xf", compressed_path], cwd=dirs['abs_work_dir'],
-                         halt_on_failure=True, fatal_exit_code=3)
-        self.geckodriver_path = os.path.join(dirs['abs_work_dir'], "geckodriver")
-
     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,
                                         error_list=BaseErrorList + HarnessErrorList)