Files
node/test/wasi
Shelley Vohr bb8f1148c4 test: fix the thread-spawn handshake in the WASI threads fixture
test-wasi-pthread fails now and then on every platform with
"Assertion failed: r == 0 (c/pthread.c: main: 17)", i.e.
pthread_create() itself reporting an error. The fixture implements
`thread-spawn` by starting a Worker and blocking in
Atomics.wait(result, 0, 0, 1000) until the worker signals that it has
instantiated the module. Two things go wrong there: the worker signals
success by storing 0, the value the main thread is already waiting on,
so when the worker is quicker than the main thread its notify is lost
and the wait runs into the timeout; and one second is not always enough
for a Worker to start and instantiate a threads build on the slower CI
hosts (arm debug, Windows, macOS). Either way spawn() returns -6 and
wasi-libc turns that into a pthread_create() failure.

Wait on a sentinel value that neither outcome writes, and give the
worker a platform-scaled 30 seconds. Drop the flaky markers.

Fixes: https://github.com/nodejs/node/issues/64226
Refs: https://github.com/nodejs/node/issues/59146
Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65780
Refs: https://github.com/nodejs/node/issues/54534
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-09-06 08:43:52 +00:00
..
2026-09-02 01:58:40 +00:00
…
2025-08-18 12:17:56 +00:00
2025-08-18 12:17:56 +00:00
2025-08-18 12:17:56 +00:00
2025-08-18 12:17:56 +00:00
2025-08-18 12:17:56 +00:00

WASI Tests

Compile with clang and wasm32-wasi target by using the wasi-sdk version 20

Install wasi-sdk and then set WASI_SDK_PATH to the root of the install.

You can then rebuild the wasm for the tests by running:

make CC=${WASI_SDK_PATH}/bin/clang SYSROOT=${WASI_SDK_PATH}/share/wasi-sysroot

If you update the version of the wasi-sdk to be used for the compile remove all of the *.wasm files in the wasm directory to ensure you rebuild/test all of the tests with the new version.