Skip to content

Commit

Permalink
Meta: Support importing WPT ref tests that use an absolute path
Browse files Browse the repository at this point in the history
For example, a few ref tests have a match like this:
```
<link rel="match"
      href="/css/reference/ref-filled-green-100px-square-only.html">
```

Previously we'd interpret this as `http://css/reference/...` which made
the test runner sad.
  • Loading branch information
AtkinsSJ committed Nov 6, 2024
1 parent 6707615 commit 91d32d4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Meta/import-wpt-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,18 @@ def main():
raise RuntimeError('Failed to file reference path in ref test')

if raw_reference_path is not None:
reference_path = Path(resource_path).parent.joinpath(raw_reference_path).__str__()
main_paths.append(PathMapping(
wpt_base_url + '/' + reference_path,
Path(test_type.expected_path + '/' + reference_path).absolute()
))
if raw_reference_path.startswith('/'):
reference_path = raw_reference_path
main_paths.append(PathMapping(
wpt_base_url + raw_reference_path,
Path(test_type.expected_path + raw_reference_path).absolute()
))
else:
reference_path = Path(resource_path).parent.joinpath(raw_reference_path).__str__()
main_paths.append(PathMapping(
wpt_base_url + '/' + reference_path,
Path(test_type.expected_path + '/' + reference_path).absolute()
))

files_to_modify = download_files(main_paths)
create_expectation_files(main_paths)
Expand Down

0 comments on commit 91d32d4

Please sign in to comment.