Bug 1493368 [wpt PR 13154] - [wptrunner] Fix support for `--binary-arg` in Fx, a=testonly
authorjugglinmike <mike@mikepennisi.com>
Wed, 26 Sep 2018 10:47:15 +0000
changeset 438483 75d065357544a5564e20d80d52b52f2bda23656f
parent 438482 701c20b730d31b6c60a5bb766fe6590bb30b3fd3
child 438484 92cd7b62a53b6717d7fbe42201e750a7801c48fa
push id108320
push userwptsync@mozilla.com
push dateThu, 27 Sep 2018 09:58:16 +0000
treeherdermozilla-inbound@541b5d1ac630 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1493368, 13154
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 1493368 [wpt PR 13154] - [wptrunner] Fix support for `--binary-arg` in Fx, a=testonly Automatic update from web-platform-tests[wptrunner] Fix support for `--binary-arg` in Fx (#13154) In order to automate Firefox, wptrunner requires the browser's internal module "Marionette" to be enabled. This is a requirement regardless of any custom configuration specified by the user, including additional command-line flags via the `--binary-arg` argument. Previously, this project would omit the `-marionette` argument in the presence of any user-specified arguments. Because this interferes with normal operation (and because the source code is formatted in a way that conflicts with the order of operations), this is likely an unintentional behavior. Modify the code which derives the command-line arguments to always include the `-marionette` argument. -- wpt-commits: 3a749a13168916563b9611528b18d0376f04aab1 wpt-pr: 13154
testing/web-platform/tests/tools/wpt/tests/test_wpt.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
--- a/testing/web-platform/tests/tools/wpt/tests/test_wpt.py
+++ b/testing/web-platform/tests/tools/wpt/tests/test_wpt.py
@@ -164,33 +164,35 @@ def test_list_tests_invalid_manifest(man
 @pytest.mark.xfail(sys.platform == "win32",
                    reason="Tests currently don't work on Windows for path reasons")
 def test_run_firefox(manifest_dir):
     # TODO: It seems like there's a bug in argparse that makes this argument order required
     # should try to work around that
     if is_port_8000_in_use():
         pytest.skip("port 8000 already in use")
 
-    os.environ["MOZ_HEADLESS"] = "1"
-    try:
-        if sys.platform == "darwin":
-            fx_path = os.path.join(wpt.localpaths.repo_root, "_venv", "browsers", "nightly", "Firefox Nightly.app")
-        else:
-            fx_path = os.path.join(wpt.localpaths.repo_root, "_venv", "browsers", "nightly", "firefox")
-        if os.path.exists(fx_path):
-            shutil.rmtree(fx_path)
-        with pytest.raises(SystemExit) as excinfo:
-            wpt.main(argv=["run", "--no-pause", "--install-browser", "--yes",
-                           "--metadata", manifest_dir,
-                           "firefox", "/dom/nodes/Element-tagName.html"])
-        assert os.path.exists(fx_path)
+    if sys.platform == "darwin":
+        fx_path = os.path.join(wpt.localpaths.repo_root, "_venv", "browsers", "nightly", "Firefox Nightly.app")
+    else:
+        fx_path = os.path.join(wpt.localpaths.repo_root, "_venv", "browsers", "nightly", "firefox")
+    if os.path.exists(fx_path):
         shutil.rmtree(fx_path)
-        assert excinfo.value.code == 0
-    finally:
-        del os.environ["MOZ_HEADLESS"]
+    with pytest.raises(SystemExit) as excinfo:
+        wpt.main(argv=["run", "--no-pause", "--install-browser", "--yes",
+                       # The use of `--binary-args` is intentional: it
+                       # demonstrates that internally-managed command-line
+                       # arguments are properly merged with those specified by
+                       # the user. See
+                       # https://github.com/web-platform-tests/wpt/pull/13154
+                       "--binary-arg=-headless",
+                       "--metadata", manifest_dir,
+                       "firefox", "/dom/nodes/Element-tagName.html"])
+    assert os.path.exists(fx_path)
+    shutil.rmtree(fx_path)
+    assert excinfo.value.code == 0
 
 
 @pytest.mark.slow
 @pytest.mark.xfail(sys.platform == "win32",
                    reason="Tests currently don't work on Windows for path reasons")
 def test_run_chrome(manifest_dir):
     if is_port_8000_in_use():
         pytest.skip("port 8000 already in use")
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
@@ -246,19 +246,21 @@ class FirefoxBrowser(Browser):
         # Bug 1262954: winxp + e10s, disable hwaccel
         if (self.e10s and platform.system() in ("Windows", "Microsoft") and
             '5.1' in platform.version()):
             self.profile.set_preferences({"layers.acceleration.disabled": True})
 
         if self.ca_certificate_path is not None:
             self.setup_ssl()
 
+        args = self.binary_args[:] if self.binary_args else []
+        args += [cmd_arg("marionette"), "about:blank"]
+
         debug_args, cmd = browser_command(self.binary,
-                                          self.binary_args if self.binary_args else [] +
-                                          [cmd_arg("marionette"), "about:blank"],
+                                          args,
                                           self.debug_info)
 
         self.runner = FirefoxRunner(profile=self.profile,
                                     binary=cmd[0],
                                     cmdargs=cmd[1:],
                                     env=env,
                                     process_class=ProcessHandler,
                                     process_args={"processOutputLine": [self.on_output]})