diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-08-14 12:21:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-14 10:21:29 +0000 |
commit | 1d79f5dad2a8b006bddf1cabec519f21a1fe6d31 (patch) | |
tree | 819a12982b155029db401716d7e37ee2ac5db0dd /python/wpt/run.py | |
parent | cc86854c4efefe21dbcd2746a05c379b8f1fb479 (diff) | |
download | servo-1d79f5dad2a8b006bddf1cabec519f21a1fe6d31.tar.gz servo-1d79f5dad2a8b006bddf1cabec519f21a1fe6d31.zip |
Make the `--release`/`--dev` more consistent and less surprising (#30091)
There were some issues with the way that the `--release` and `--dev`
arguments were handled in mach commands.
- Not all commands accepted them in the same way. For instance `./mach
test-wpt` didn't really accept them at all.
- If you did not pass either of them, mach would try to guess which
build you meant. This guess was often quite surprising as it wasn't
printed and it depended on the state of the your target directory,
which is difficult to remember.
- The `dev` profile is colloquially called a "debug" profile and some
commands accepted `-d` or `--debug...` like arguments, but `--debug`
with `./mach run` meant run in a debugger. It was easy to mix this
up.
This change:
- Centralizes where build type argument processing happens. Now it the
same shared decorator in CommandBase.
- Uses a `BuildType` enum instead of passing around two different
booleans. This reduces the error checking for situations where both
are true.
- Be much less clever about guessing what build to use. Now if you
don't specify a build type, `--dev` is chosen. I think this behavior
matches cargo.
- Makes it so that `./mach test-wpt` accepts the exact same arguments
and has the same behavior as other commands. In addition, the suite
correct for `test-wpt` is removed. There are only two suites now and
it's quite unlikely that people will confuse WPT tests for rust unit
tests.
Diffstat (limited to 'python/wpt/run.py')
-rw-r--r-- | python/wpt/run.py | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/python/wpt/run.py b/python/wpt/run.py index 558312164ed..ab028f670c1 100644 --- a/python/wpt/run.py +++ b/python/wpt/run.py @@ -33,24 +33,13 @@ TRACKER_API_ENV_VAR = "INTERMITTENT_TRACKER_API" TRACKER_DASHBOARD_SECRET_ENV_VAR = "INTERMITTENT_TRACKER_DASHBOARD_SECRET" -def determine_build_type(kwargs: dict, target_dir: str): - if kwargs["release"]: - return "release" - elif kwargs["debug"]: - return "debug" - elif os.path.exists(os.path.join(target_dir, "debug")): - return "debug" - elif os.path.exists(os.path.join(target_dir, "release")): - return "release" - return "debug" - - def set_if_none(args: dict, key: str, value): if key not in args or args[key] is None: args[key] = value -def run_tests(**kwargs): +def run_tests(default_binary_path: str, **kwargs): + print(default_binary_path) # By default, Rayon selects the number of worker threads based on the # available CPU count. This doesn't work very well when running tests on CI, # since we run so many Servo processes in parallel. The result is a lot of @@ -79,17 +68,6 @@ def run_tests(**kwargs): kwargs["user_stylesheets"].append(os.path.join(SERVO_ROOT, "resources", "ahem.css")) - if "CARGO_TARGET_DIR" in os.environ: - target_dir = os.path.join(os.environ["CARGO_TARGET_DIR"]) - else: - target_dir = os.path.join(SERVO_ROOT, "target") - - binary_name = ("servo.exe" if sys.platform == "win32" else "servo") - - default_binary_path = os.path.join( - target_dir, determine_build_type(kwargs, target_dir), binary_name - ) - set_if_none(kwargs, "binary", default_binary_path) set_if_none(kwargs, "webdriver_binary", default_binary_path) |