Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ Finally, clone or sync test262 itself:

## Usage

In the below command, `LADYBIRD_SOURCE_DIR` should point to the Ladybird checkout. The exact path to `test262-runner`
may vary depending on any extra options that were provided to `ladybird.py` above.
If you've built Ladybird with its default configuration, and you have set `LADYBIRD_SOURCE_DIR` to point at your Ladybird
checkout, you can run the following command to run all tests:

```bash
./main.py
```

You may also override the path to the test262-runner and the path to the test262 tests:

```bash
./main.py --libjs-test262-runner "${LADYBIRD_SOURCE_DIR}/Build/release/bin/test262-runner" --test262-root ./test262
Expand Down
19 changes: 18 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,32 @@ def write_output(message: Any):
self.log(f"Finished running tests in {self.duration}.")


def default_test262_runner_path() -> Path | None:
ladybird_source_dir = os.environ.get("LADYBIRD_SOURCE_DIR")

if ladybird_source_dir:
default_test262_runner = (
Path(ladybird_source_dir) / "Build" / "release" / "bin" / "test262-runner"
)

if default_test262_runner.exists():
return default_test262_runner

return None


def main() -> None:
default_test262_runner = default_test262_runner_path()

parser = ArgumentParser(
description="Run the test262 ECMAScript test suite with Ladybird's LibJS",
epilog=", ".join(f"{EMOJIS[result]} = {result.value}" for result in TestResult),
)
parser.add_argument(
"-j",
"--libjs-test262-runner",
required=True,
required=default_test262_runner is None,
default=str(default_test262_runner) if default_test262_runner else None,
metavar="PATH",
help="path to the 'test262-runner' binary",
)
Expand Down