-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize Servo's WPT Python scripts
This change moves all of Servo's WPT Python support scripts into one directory as they were previously scattered throughout the directory structure. This should allow more code reuse and make it easier to understand how everything fits together. The changes: - `tests/wpt/update` → `python/wpt/importer` - `etc/ci/upstream-wpt-changes/wptupstreamer` → `python/wpt/exporter` - `etc/ci/upstream-wpt-changes/test.py` → `python/wpt/test.py` - `etc/ci/upstream-wpt-changes/tests` → `python/wpt/tests` - `tests/wpt/servowpt.py` → - `python/wpt/update.py` - `python/wpt/run.py` - `tests/wpt/manifestupdate.py` → `python/wpt/manifestupdate.py` This change also removes - The ability to run the `update-wpt` and `test-wpt` commands without using `mach`. These didn't work very well, because it was difficult to get all of the wptrunner and mach dependencies installed outside of the Python virtualenv. It's simpler if they are always run through `mach`. - The old WPT change upstreaming script that was no longer used.
- Loading branch information
Showing
52 changed files
with
236 additions
and
886 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# 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 | ||
|
||
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, "web-platform-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('--release', default=False, action="store_true", | ||
help="Run with a release build of servo") | ||
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('--layout-2020', '--with-layout-2020', default=False, | ||
action="store_true", help="Use expected results for the 2020 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_layout_2020(kwargs: dict): | ||
if kwargs.pop("layout_2020"): | ||
kwargs["test_paths"]["/"]["metadata_path"] = os.path.join( | ||
WPT_PATH, "metadata-layout-2020" | ||
) | ||
kwargs["test_paths"]["/_mozilla/"]["metadata_path"] = os.path.join( | ||
WPT_PATH, "mozilla", "meta-layout-2020" | ||
) | ||
kwargs["include_manifest"] = os.path.join( | ||
WPT_PATH, "include-layout-2020.ini" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
import os | ||
import sys | ||
|
||
from .tree import GitTree, GeckoCommit | ||
|
||
from wptrunner.update import setup_logging, WPTUpdate # noqa: F401 | ||
from wptrunner.update.base import Step, StepRunner, exit_unclean # noqa: F401 | ||
from wptrunner.update.update import LoadConfig, SyncFromUpstream, UpdateMetadata # noqa: F401 | ||
from wptrunner import wptcommandline # noqa: F401 | ||
|
||
|
||
class LoadTrees(Step): | ||
"""Load gecko tree and sync tree containing web-platform-tests""" | ||
|
||
provides = ["local_tree", "sync_tree"] | ||
|
||
def create(self, state): | ||
if os.path.exists(state.sync["path"]): | ||
sync_tree = GitTree(root=state.sync["path"]) | ||
else: | ||
sync_tree = None | ||
|
||
assert GitTree.is_type() | ||
state.update({"local_tree": GitTree(commit_cls=GeckoCommit), | ||
"sync_tree": sync_tree}) | ||
|
||
|
||
class UpdateRunner(StepRunner): | ||
"""Overall runner for updating web-platform-tests in Gecko.""" | ||
steps = [LoadConfig, | ||
LoadTrees, | ||
SyncFromUpstream, | ||
UpdateMetadata] | ||
|
||
|
||
def run_update(**kwargs): | ||
logger = setup_logging(kwargs, {"mach": sys.stdout}) | ||
updater = WPTUpdate(logger, runner_cls=UpdateRunner, **kwargs) | ||
return updater.run() != exit_unclean | ||
|
||
|
||
def create_parser(): | ||
parser = wptcommandline.create_parser_update() | ||
parser.add_argument("--layout-2020", "--with-layout-2020", default=False, action="store_true", | ||
help="Use expected results for the 2020 layout engine") | ||
return parser | ||
|
||
|
||
def check_args(kwargs): | ||
wptcommandline.set_from_config(kwargs) | ||
if hasattr(wptcommandline, 'check_paths'): | ||
wptcommandline.check_paths(kwargs) | ||
return kwargs |
Oops, something went wrong.