aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/wpt/meta/MANIFEST.json2
-rw-r--r--tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py17
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json
index 71712e32821..c62a5120318 100644
--- a/tests/wpt/meta/MANIFEST.json
+++ b/tests/wpt/meta/MANIFEST.json
@@ -490288,7 +490288,7 @@
[]
],
"executorservo.py": [
- "c23f7632c9ef5f0acbdbb569db41f741ccf9de89",
+ "90251c1e4c6b6ffd150184005466aecdc76d180d",
[]
],
"executorservodriver.py": [
diff --git a/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py b/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py
index c23f7632c9e..90251c1e4c6 100644
--- a/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py
+++ b/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py
@@ -38,6 +38,8 @@ class ServoExecutor(ProcessTestExecutor):
self.environment = {}
self.protocol = ConnectionlessProtocol(self, browser)
+ self.wpt_prefs_path = self.find_wpt_prefs()
+
hosts_fd, self.hosts_path = tempfile.mkstemp()
with os.fdopen(hosts_fd, "w") as f:
f.write(make_hosts_file(server_config, "127.0.0.1"))
@@ -64,6 +66,19 @@ class ServoExecutor(ProcessTestExecutor):
else:
self.logger.process_output(self.proc.pid, line, " ".join(self.command), self.test.url)
+ def find_wpt_prefs(self):
+ default_path = os.path.join("resources", "wpt-prefs.json")
+ # The cwd is the servo repo for `./mach test-wpt`, but on WPT runners
+ # it is the virtual environment where the nightly is extracted. In the
+ # latter case, the cwd has the `servo` folder inside which we find the
+ # binary and the 'resources' directory.
+ for dir in [".", "./servo"]:
+ candidate = os.path.abspath(os.path.join(dir, default_path))
+ if os.path.isfile(candidate):
+ return candidate
+ self.logger.error("Unable to find wpt-prefs.json")
+ return default_path
+
def build_servo_command(self, test, extra_args=None, debug_opts="replace-surrogates"):
args = [
"--hard-fail", "-u", "Servo/wptrunner",
@@ -78,7 +93,7 @@ class ServoExecutor(ProcessTestExecutor):
args += ["--user-stylesheet", stylesheet]
for pref, value in self.environment.get('prefs', {}).items():
args += ["--pref", f"{pref}={value}"]
- args += ["--prefs-file", "resources/wpt-prefs.json"]
+ args += ["--prefs-file", self.wpt_prefs_path]
if self.browser.ca_certificate_path:
args += ["--certificate-path", self.browser.ca_certificate_path]
if extra_args: