Meta: Support importing WPT ref tests that use an absolute path

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.
This commit is contained in:
Sam Atkins 2024-11-06 14:14:46 +00:00 committed by Andreas Kling
parent 8673dd4e6e
commit f2407cd511
Notes: github-actions[bot] 2024-11-06 19:04:42 +00:00

View file

@ -222,11 +222,18 @@ def main():
raise RuntimeError('Failed to file reference path in ref test') raise RuntimeError('Failed to file reference path in ref test')
if raw_reference_path is not None: if raw_reference_path is not None:
reference_path = Path(resource_path).parent.joinpath(raw_reference_path).__str__() if raw_reference_path.startswith('/'):
main_paths.append(PathMapping( reference_path = raw_reference_path
wpt_base_url + '/' + reference_path, main_paths.append(PathMapping(
Path(test_type.expected_path + '/' + reference_path).absolute() 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) files_to_modify = download_files(main_paths)
create_expectation_files(main_paths) create_expectation_files(main_paths)