From f2407cd5110ce5b46bcde049db674fe1cba4d7ab Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 6 Nov 2024 14:14:46 +0000 Subject: [PATCH] Meta: Support importing WPT ref tests that use an absolute path For example, a few ref tests have a match like this: ``` ``` Previously we'd interpret this as `http://css/reference/...` which made the test runner sad. --- Meta/import-wpt-test.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Meta/import-wpt-test.py b/Meta/import-wpt-test.py index 6ab33c51bb5..c971895c4c1 100755 --- a/Meta/import-wpt-test.py +++ b/Meta/import-wpt-test.py @@ -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)