Skip to content

[threads][test][js-api] Add worker-based tests for Wait/Notify#251

Open
backes wants to merge 2 commits intoWebAssembly:mainfrom
backes:add-wait-notify-worker-tests
Open

[threads][test][js-api] Add worker-based tests for Wait/Notify#251
backes wants to merge 2 commits intoWebAssembly:mainfrom
backes:add-wait-notify-worker-tests

Conversation

@backes
Copy link
Member

@backes backes commented Mar 17, 2026

Extend JS API tests for Atomics.wait and Atomics.notify with worker-based
scenarios. These tests verify that workers can be correctly woken up by
notify calls on shared WebAssembly.Memory.

Specifically:

  • Add worker-path-helper.js to handle worker script path resolution in
    different environments (WPT vs JS shells).
  • Add wait-notify-worker.js to execute the wait operation in a background
    thread.
  • Add test cases to wait-notify-shared.any.js covering single waiter,
    sequential multiple waiters, and simultaneous multiple waiters.

backes added 2 commits March 17, 2026 16:52
Add JS API tests for Atomics.wait and Atomics.notify on WebAssembly.Memory.
- On shared memory: Atomics.notify should return the number of notified
  waiters, and Atomics.wait should return the appropriate wait status.
- On unshared memory: Atomics.notify should return 0, while Atomics.wait
  should trap (throwing a WebAssembly.RuntimeError).
Extend JS API tests for Atomics.wait and Atomics.notify with worker-based
scenarios. These tests verify that workers can be correctly woken up by
notify calls on shared WebAssembly.Memory.

Specifically:
- Add worker-path-helper.js to handle worker script path resolution in
  different environments (WPT vs JS shells).
- Add wait-notify-worker.js to execute the wait operation in a background
  thread.
- Add test cases to wait-notify-shared.any.js covering single waiter,
  sequential multiple waiters, and simultaneous multiple waiters.
@backes
Copy link
Member Author

backes commented Mar 17, 2026

This PR is based on #250 and extends the test. I don't know how to create such stacked PRs on Github. The first commit is the same as in #250, the second one adds new worker-based tests.

I didn't find precedence for such worker tests but tried my best to make them work in all environments. This might need further adjustments if some shells or browsers run into issues, potentially after syncing this to WPT.

After #250 got merged we can rebase this PR and it will only contain the added lines and files.

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.

1 participant