From 4b1f0b767a22ffe569143ca0bffc381a54902c90 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 15 Aug 2025 23:20:48 +0200 Subject: [PATCH 1/2] test: split test-wasi.js There is a flake in the tests. Split them so that people stop piling more test cases that flake the monolith. --- test/wasi/test-wasi-cant_dotdot.js | 7 +++++ test/wasi/test-wasi-clock_getres.js | 8 +++++ test/wasi/test-wasi-fd_prestat_get_refresh.js | 7 +++++ test/wasi/test-wasi-ftruncate.js | 7 +++++ test/wasi/test-wasi-getentropy.js | 7 +++++ test/wasi/test-wasi-getrusage.js | 7 +++++ test/wasi/test-wasi-gettimeofday.js | 7 +++++ test/wasi/test-wasi-main_args.js | 7 +++++ test/wasi/test-wasi-notdir.js | 7 +++++ test/wasi/test-wasi-preopen_populates.js | 7 +++++ test/wasi/test-wasi-pthread.js | 7 +++++ test/wasi/test-wasi-readdir.js | 7 +++++ test/wasi/test-wasi-sock.js | 7 +++++ test/wasi/test-wasi-stat.js | 7 +++++ test/wasi/test-wasi-write_file.js | 7 +++++ test/wasi/test-wasi.js | 29 ------------------- test/wasi/wasi.status | 8 +++++ 17 files changed, 114 insertions(+), 29 deletions(-) create mode 100644 test/wasi/test-wasi-cant_dotdot.js create mode 100644 test/wasi/test-wasi-clock_getres.js create mode 100644 test/wasi/test-wasi-fd_prestat_get_refresh.js create mode 100644 test/wasi/test-wasi-ftruncate.js create mode 100644 test/wasi/test-wasi-getentropy.js create mode 100644 test/wasi/test-wasi-getrusage.js create mode 100644 test/wasi/test-wasi-gettimeofday.js create mode 100644 test/wasi/test-wasi-main_args.js create mode 100644 test/wasi/test-wasi-notdir.js create mode 100644 test/wasi/test-wasi-preopen_populates.js create mode 100644 test/wasi/test-wasi-pthread.js create mode 100644 test/wasi/test-wasi-readdir.js create mode 100644 test/wasi/test-wasi-sock.js create mode 100644 test/wasi/test-wasi-stat.js create mode 100644 test/wasi/test-wasi-write_file.js delete mode 100644 test/wasi/test-wasi.js diff --git a/test/wasi/test-wasi-cant_dotdot.js b/test/wasi/test-wasi-cant_dotdot.js new file mode 100644 index 00000000000000..5740d382770bd8 --- /dev/null +++ b/test/wasi/test-wasi-cant_dotdot.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/cant_dotdot.wasm, see test/wasi/c/cant_dotdot.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['cant_dotdot']); diff --git a/test/wasi/test-wasi-clock_getres.js b/test/wasi/test-wasi-clock_getres.js new file mode 100644 index 00000000000000..609c925ab58008 --- /dev/null +++ b/test/wasi/test-wasi-clock_getres.js @@ -0,0 +1,8 @@ +'use strict'; + +// Tests test/wasi/wasm/clock_getres.wasm, see test/wasi/c/clock_getres.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +// This test is currently unsupported on IBM i PASE +testWasiPreview1(['clock_getres']); diff --git a/test/wasi/test-wasi-fd_prestat_get_refresh.js b/test/wasi/test-wasi-fd_prestat_get_refresh.js new file mode 100644 index 00000000000000..16a3785ceb1e68 --- /dev/null +++ b/test/wasi/test-wasi-fd_prestat_get_refresh.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/fd_prestat_get_refresh.wasm, see test/wasi/c/fd_prestat_get_refresh.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['fd_prestat_get_refresh']); diff --git a/test/wasi/test-wasi-ftruncate.js b/test/wasi/test-wasi-ftruncate.js new file mode 100644 index 00000000000000..c4af685ebf7fea --- /dev/null +++ b/test/wasi/test-wasi-ftruncate.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/ftruncate.wasm, see test/wasi/c/ftruncate.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['ftruncate']); diff --git a/test/wasi/test-wasi-getentropy.js b/test/wasi/test-wasi-getentropy.js new file mode 100644 index 00000000000000..75d61465ca7f79 --- /dev/null +++ b/test/wasi/test-wasi-getentropy.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/getentropy.wasm, see test/wasi/c/getentropy.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['getentropy']); diff --git a/test/wasi/test-wasi-getrusage.js b/test/wasi/test-wasi-getrusage.js new file mode 100644 index 00000000000000..845881691e3150 --- /dev/null +++ b/test/wasi/test-wasi-getrusage.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/getrusage.wasm, see test/wasi/c/getrusage.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['getrusage']); diff --git a/test/wasi/test-wasi-gettimeofday.js b/test/wasi/test-wasi-gettimeofday.js new file mode 100644 index 00000000000000..56fc652a2ef983 --- /dev/null +++ b/test/wasi/test-wasi-gettimeofday.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/gettimeofday.wasm, see test/wasi/c/gettimeofday.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['gettimeofday']); diff --git a/test/wasi/test-wasi-main_args.js b/test/wasi/test-wasi-main_args.js new file mode 100644 index 00000000000000..1667f3f4c0ad39 --- /dev/null +++ b/test/wasi/test-wasi-main_args.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/main_args.wasm, see test/wasi/c/main_args.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['main_args']); diff --git a/test/wasi/test-wasi-notdir.js b/test/wasi/test-wasi-notdir.js new file mode 100644 index 00000000000000..f277979fc0022b --- /dev/null +++ b/test/wasi/test-wasi-notdir.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/notdir.wasm, see test/wasi/c/notdir.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['notdir']); diff --git a/test/wasi/test-wasi-preopen_populates.js b/test/wasi/test-wasi-preopen_populates.js new file mode 100644 index 00000000000000..b20008d3612a8d --- /dev/null +++ b/test/wasi/test-wasi-preopen_populates.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/preopen_populates.wasm, see test/wasi/c/preopen_populates.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['preopen_populates']); diff --git a/test/wasi/test-wasi-pthread.js b/test/wasi/test-wasi-pthread.js new file mode 100644 index 00000000000000..9cbb3380763c47 --- /dev/null +++ b/test/wasi/test-wasi-pthread.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/pthread.wasm, see test/wasi/c/pthread.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['--target=wasm32-wasip1-threads', 'pthread']); diff --git a/test/wasi/test-wasi-readdir.js b/test/wasi/test-wasi-readdir.js new file mode 100644 index 00000000000000..67714fe529404f --- /dev/null +++ b/test/wasi/test-wasi-readdir.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/readdir.wasm, see test/wasi/c/readdir.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['readdir']); diff --git a/test/wasi/test-wasi-sock.js b/test/wasi/test-wasi-sock.js new file mode 100644 index 00000000000000..245ac2ea25fc8d --- /dev/null +++ b/test/wasi/test-wasi-sock.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/sock.wasm, see test/wasi/c/sock.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['sock']); diff --git a/test/wasi/test-wasi-stat.js b/test/wasi/test-wasi-stat.js new file mode 100644 index 00000000000000..6b2eceb0a1c76c --- /dev/null +++ b/test/wasi/test-wasi-stat.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/stat.wasm, see test/wasi/c/stat.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['stat']); diff --git a/test/wasi/test-wasi-write_file.js b/test/wasi/test-wasi-write_file.js new file mode 100644 index 00000000000000..eae2e64e73d2ff --- /dev/null +++ b/test/wasi/test-wasi-write_file.js @@ -0,0 +1,7 @@ +'use strict'; + +// Tests test/wasi/wasm/write_file.wasm, see test/wasi/c/write_file.c +require('../common'); +const { testWasiPreview1 } = require('../common/wasi'); + +testWasiPreview1(['write_file']); diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js deleted file mode 100644 index 9dd583fc5bdcb9..00000000000000 --- a/test/wasi/test-wasi.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -const common = require('../common'); -const { testWasiPreview1 } = require('../common/wasi'); - -// TODO(joyeecheung): tests that don't need special configurations can be ported -// to a special python test case configuration and get run in parallel. -// Tests that are currently unsupported on IBM i PASE. -if (!common.isIBMi) { - testWasiPreview1(['clock_getres']); - testWasiPreview1(['getrusage']); -} - -// Tests that are currently unsupported on Windows and Android. -if (!common.isWindows && process.platform !== 'android') { - testWasiPreview1(['readdir']); -} - -testWasiPreview1(['cant_dotdot']); -testWasiPreview1(['fd_prestat_get_refresh']); -testWasiPreview1(['ftruncate']); -testWasiPreview1(['getentropy']); -testWasiPreview1(['gettimeofday']); -testWasiPreview1(['main_args']); -testWasiPreview1(['notdir']); -testWasiPreview1(['preopen_populates']); -testWasiPreview1(['stat']); -testWasiPreview1(['sock']); -testWasiPreview1(['write_file']); -testWasiPreview1(['--target=wasm32-wasip1-threads', 'pthread']); diff --git a/test/wasi/wasi.status b/test/wasi/wasi.status index 2870fc67f1c776..2634b9502a697a 100644 --- a/test/wasi/wasi.status +++ b/test/wasi/wasi.status @@ -6,3 +6,11 @@ prefix wasi [true] # This section applies to all platforms +[$system==ibmi] +# Unsupported on IBM i PASE +test-wasi-clock_getres: SKIP +test-wasi-getrusage: SKIP + +[$system==win32 || $system==android] +# Unsupported on Windows and Android +test-wasi-readdir: SKIP From ad9b84910641c2f8836ecd765f9c846267500613 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 15 Aug 2025 23:21:56 +0200 Subject: [PATCH 2/2] test: mark test-wasi-pthread as flaky It has been flaking the CI for two months with no one working on a fix. Mark it as flaky. --- test/wasi/wasi.status | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/wasi/wasi.status b/test/wasi/wasi.status index 2634b9502a697a..d88bd60ae4dc13 100644 --- a/test/wasi/wasi.status +++ b/test/wasi/wasi.status @@ -14,3 +14,7 @@ test-wasi-getrusage: SKIP [$system==win32 || $system==android] # Unsupported on Windows and Android test-wasi-readdir: SKIP + +[$system==linux] +# https://github.com/nodejs/node/issues/59146 +test-wasi-pthread: PASS, FLAKY