Skip to content

Wire //wasm:dtest_wasm and a Node bazel-run wrapper.#249

Open
tameware wants to merge 8 commits into
dds-bridge:developfrom
tameware:feat/dtest-wasm
Open

Wire //wasm:dtest_wasm and a Node bazel-run wrapper.#249
tameware wants to merge 8 commits into
dds-bridge:developfrom
tameware:feat/dtest-wasm

Conversation

@tameware

Copy link
Copy Markdown
Collaborator

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.

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_wasm as a bazel run-friendly Node wrapper.
  • Extends WASM system tests to execute dtest.js over hands/list1.txt and 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
tameware marked this pull request as ready for review July 22, 2026 01:40
tameware and others added 4 commits July 21, 2026 20:41
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread wasm/tests/test_wasm_examples_system.py Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread library/tests/test_timer_test.cpp
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread hands/BUILD.bazel Outdated
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread wasm/run_dtest_wasm.py
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants