mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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 #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 #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]: https://github.com/web-platform-tests/wpt/pull/49406 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
64 lines
3 KiB
Python
64 lines
3 KiB
Python
# Copyright 2023 The Servo Project Developers. See the COPYRIGHT
|
|
# file at the top-level directory of this distribution.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
# option. This file may not be copied, modified, or distributed
|
|
# except according to those terms.
|
|
|
|
import os
|
|
import sys
|
|
|
|
import mozlog.commandline
|
|
|
|
from . import test
|
|
|
|
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
|
|
SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", ".."))
|
|
WPT_PATH = os.path.join(SERVO_ROOT, "tests", "wpt")
|
|
WPT_TOOLS_PATH = os.path.join(WPT_PATH, "tests", "tools")
|
|
CERTS_PATH = os.path.join(WPT_TOOLS_PATH, "certs")
|
|
|
|
sys.path.insert(0, WPT_TOOLS_PATH)
|
|
import localpaths # noqa: F401,E402
|
|
import wptrunner.wptcommandline # noqa: E402
|
|
|
|
|
|
def create_parser():
|
|
parser = wptrunner.wptcommandline.create_parser()
|
|
parser.add_argument('--rr-chaos', default=False, action="store_true",
|
|
help="Run under chaos mode in rr until a failure is captured")
|
|
parser.add_argument('--pref', default=[], action="append", dest="prefs",
|
|
help="Pass preferences to servo")
|
|
parser.add_argument('--legacy-layout', '--layout-2013', '--with-layout-2013', default=False,
|
|
action="store_true", help="Use expected results for the legacy layout engine")
|
|
parser.add_argument('--log-servojson', action="append", type=mozlog.commandline.log_file,
|
|
help="Servo's JSON logger of unexpected results")
|
|
parser.add_argument('--always-succeed', default=False, action="store_true",
|
|
help="Always yield exit code of zero")
|
|
parser.add_argument('--no-default-test-types', default=False, action="store_true",
|
|
help="Run all of the test types provided by wptrunner or specified explicitly by --test-types")
|
|
parser.add_argument('--filter-intermittents', default=None, action="store",
|
|
help="Filter intermittents against known intermittents "
|
|
"and save the filtered output to the given file.")
|
|
parser.add_argument('--log-raw-unexpected', default=None, action="store",
|
|
help="Raw structured log messages for unexpected results."
|
|
" '--log-raw' Must also be passed in order to use this.")
|
|
return parser
|
|
|
|
|
|
def update_args_for_legacy_layout(kwargs: dict):
|
|
def override_metadata_path(url_base, metadata_path):
|
|
test_root = kwargs["test_paths"][url_base]
|
|
kwargs["test_paths"][url_base] = wptrunner.wptcommandline.TestRoot(
|
|
test_root.tests_path,
|
|
os.path.join(WPT_PATH, *metadata_path)
|
|
)
|
|
override_metadata_path("/", ["meta-legacy-layout"])
|
|
override_metadata_path("/_mozilla/", ["mozilla", "meta-legacy-layout"])
|
|
override_metadata_path("/_webgl/", ["webgl", "meta-legacy-layout"])
|
|
|
|
|
|
def run_tests():
|
|
return test.run_tests()
|