Wire //wasm:dtest_wasm and a Node bazel-run wrapper.#249
Open
tameware wants to merge 8 commits into
Open
Conversation
Port the dtest harness under Emscripten for Node (NODERAWFS) so WASM can be exercised against the same hand lists as native, with //wasm:run_dtest_wasm for convenient bazel run. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a WASM build of the existing //library/tests:dtest harness and wires it into the WASM system test flow, enabling Node/Emscripten runs over the same hand-list inputs used by native runs.
Changes:
- Introduces
//wasm:dtest_wasm(Emscripten build of//library/tests:dtest) plus//wasm:run_dtest_wasmas abazel run-friendly Node wrapper. - Extends WASM system tests to execute
dtest.jsoverhands/list1.txtand adds unit tests for the Python Node-runner helpers. - Updates WASM capability/docs to describe the new harness and how to run it.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
wasm/tests/test_wasm_examples_system.py |
Adds an end-to-end Node execution test for dtest_wasm on hands/list1.txt. |
wasm/tests/test_run_dtest_wasm.py |
Adds unit tests for run_dtest_wasm.py helper functions (rlocation, cwd selection, argv wiring). |
wasm/run_dtest_wasm.py |
New py_binary entrypoint to run the dtest.js WASM loader under Node with forwarded args. |
wasm/BUILD.bazel |
Adds dtest_wasm, run_dtest_wasm, a unit test target, and updates WASM system test data deps and suite membership. |
specs/wasm-emscripten.md |
Updates capability doc to include dtest_wasm and the runner target. |
MODULE.bazel.lock |
Lockfile digest update consistent with module graph usage changes. |
library/tests/BUILD.bazel |
Adds a WASM-only linkopts select enabling Node runtime + NODERAWFS for the dtest harness. |
hands/BUILD.bazel |
Creates a Bazel package exporting list1.txt so WASM tests can depend on it via runfiles. |
docs/wasm_build.md |
Documents dtest_wasm outputs and provides example commands for Node and bazel run. |
tameware
marked this pull request as ready for review
July 22, 2026 01:40
Integer `1000 * clock_delta` wraps for batches longer than ~2.15s, so convert via floating point and cover it with a unit test. Co-authored-by: Cursor <cursoragent@cursor.com>
Windows uses CLOCKS_PER_SEC=1000, so a fixed ~3.5s delta never wraps int32; pick the minimal tick count that does. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Narrowing out-of-range values to int32 is implementation-defined; modulo 2^32 plus signed remapping keeps the overflow fixture portable. Co-authored-by: Cursor <cursoragent@cursor.com>
Make the exports_files visibility explicit so cross-package deps (e.g. WASM system tests) stay clear and match other packages. Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines
+19
to
+37
| def rlocation(relpath: str) -> Path: | ||
| """Resolve a runfiles path such as ``wasm/dtest.js``.""" | ||
| name = Path(relpath).name | ||
| candidates: list[Path] = [] | ||
|
|
||
| # Same Bazel package: data deps land beside this script under bazel run. | ||
| # Do not Path.resolve() — that follows the runfiles symlink into the | ||
| # source tree and loses the sibling .js/.wasm data deps. | ||
| candidates.append(Path(__file__).absolute().parent / name) | ||
|
|
||
| root = _runfiles_root() | ||
| if root is not None: | ||
| candidates.append(root / relpath) | ||
| candidates.append(root / "_main" / relpath) | ||
|
|
||
| for candidate in candidates: | ||
| if candidate.exists(): | ||
| return candidate | ||
| raise FileNotFoundError(relpath) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port the dtest harness under Emscripten for Node (NODERAWFS) so WASM can be exercised against the same hand lists as native, with //wasm:run_dtest_wasm for convenient bazel run.