Skip to content

Commit 692072e

Browse files
committed
Add a default value for --libjs-test262-runner
If LADYBIRD_SOURCE_DIR is set and the default (release) build exists, let's default the --libjs-test262-runner flag to that path.
1 parent 029c60b commit 692072e

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ Finally, clone or sync test262 itself:
3232

3333
## Usage
3434

35-
In the below command, `LADYBIRD_SOURCE_DIR` should point to the Ladybird checkout. The exact path to `test262-runner`
36-
may vary depending on any extra options that were provided to `ladybird.py` above.
35+
If you've built Ladybird with its default configuration, and you have set `LADYBIRD_SOURCE_DIR` to point at your Ladybird
36+
checkout, you can run the following command to run all tests:
37+
38+
```bash
39+
./main.py
40+
```
41+
42+
You may also override the path to the test262-runner and the path to the test262 tests:
3743

3844
```bash
3945
./main.py --libjs-test262-runner "${LADYBIRD_SOURCE_DIR}/Build/release/bin/test262-runner" --test262-root ./test262

main.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,15 +494,32 @@ def write_output(message: Any):
494494
self.log(f"Finished running tests in {self.duration}.")
495495

496496

497+
def default_test262_runner_path() -> Path | None:
498+
ladybird_source_dir = os.environ.get("LADYBIRD_SOURCE_DIR")
499+
500+
if ladybird_source_dir:
501+
default_test262_runner = (
502+
Path(ladybird_source_dir) / "Build" / "release" / "bin" / "test262-runner"
503+
)
504+
505+
if default_test262_runner.exists():
506+
return default_test262_runner
507+
508+
return None
509+
510+
497511
def main() -> None:
512+
default_test262_runner = default_test262_runner_path()
513+
498514
parser = ArgumentParser(
499515
description="Run the test262 ECMAScript test suite with Ladybird's LibJS",
500516
epilog=", ".join(f"{EMOJIS[result]} = {result.value}" for result in TestResult),
501517
)
502518
parser.add_argument(
503519
"-j",
504520
"--libjs-test262-runner",
505-
required=True,
521+
required=default_test262_runner is None,
522+
default=str(default_test262_runner) if default_test262_runner else None,
506523
metavar="PATH",
507524
help="path to the 'test262-runner' binary",
508525
)

0 commit comments

Comments
 (0)