Skip to content

Commit c6d7c57

Browse files
authored
mach: fix logic to override paths for legacy layout (servo#34467)
wptrunner internally derives the path to the MANIFEST.json file from the `metadata_path` passed via `test_paths`. The current logic overrides only the `metadata_path`, leaving the manifest_path pointing at the wrong (non-legacy) layout's MANIFEST.json. In servo#34436 we observed that the recent WPT imports create a transient `.cache` diretory that wptrunner logic uses for optimization. This has not been observed until servo#34436 because a [recent bump in MANIFEST.json's schema version][1] triggered the creation of the cache. Because of the above issue with incorrect path and the fact that we *first* trigger `mach update-wpt` for legacy layout during WPT import, the MANIFEST.json of non-legacy layout gets incorrectly migrated during the invocation of `update-wpt` for legacy layout but the cache is still created under legacy-layout's path as it is not based on `manifest_path`. The subsequent invocation of `mach update-wpt` for non-legacy finds the MANIFEST.json already migrated so the `.cache` directory is not constucted. This change simply replaces the whole object using the wptrunner's `TestRoot` class constructor so that all derived paths are calculated correctly. We also add the `.cache` folders to gitignore as it seems like they are expected to be created during such version migrations. [1]: web-platform-tests/wpt#49406 Signed-off-by: Mukilan Thiyagarajan <[email protected]>
1 parent 9028c8c commit c6d7c57

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/python/_venv*
1313
/python/tidy/servo_tidy.egg-info
1414
/tests/wpt/sync
15+
/tests/wpt/**/**/.cache/
1516
/tests/dromaeo/dromaeo
1617
*.pkl
1718
*.pyc

Diff for: python/wpt/__init__.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ def create_parser():
4949

5050

5151
def update_args_for_legacy_layout(kwargs: dict):
52-
kwargs["test_paths"]["/"].metadata_path = os.path.join(
53-
WPT_PATH, "meta-legacy-layout"
54-
)
55-
kwargs["test_paths"]["/_mozilla/"].metadata_path = os.path.join(
56-
WPT_PATH, "mozilla", "meta-legacy-layout"
57-
)
58-
kwargs["test_paths"]["/_webgl/"].metadata_path = os.path.join(
59-
WPT_PATH, "webgl", "meta-legacy-layout"
60-
)
52+
def override_metadata_path(url_base, metadata_path):
53+
test_root = kwargs["test_paths"][url_base]
54+
kwargs["test_paths"][url_base] = wptrunner.wptcommandline.TestRoot(
55+
test_root.tests_path,
56+
os.path.join(WPT_PATH, *metadata_path)
57+
)
58+
override_metadata_path("/", ["meta-legacy-layout"])
59+
override_metadata_path("/_mozilla/", ["mozilla", "meta-legacy-layout"])
60+
override_metadata_path("/_webgl/", ["webgl", "meta-legacy-layout"])
6161

6262

6363
def run_tests():

Diff for: servo-tidy.toml

+7
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ directories = [
123123
"./target",
124124
"./support/crown/target",
125125
"./third_party",
126+
# Cache files generated by wptrunner which fail the EOF newlines check.
127+
"./tests/wpt/meta/.cache",
128+
"./tests/wpt/meta-legacy-layout/.cache",
129+
"./tests/wpt/mozilla/meta/.cache",
130+
"./tests/wpt/mozilla/meta-legacy-layout/.cache",
131+
"./tests/wpt/webgl/meta/.cache",
132+
"./tests/wpt/webgl/meta-legacy-layout/.cache",
126133
]
127134

128135
# Directories that are checked for correct file extension

0 commit comments

Comments
 (0)