diff --git a/test/wasi/README.md b/test/wasi/README.md index b99b4fa76d3993..6aab9dd0581514 100644 --- a/test/wasi/README.md +++ b/test/wasi/README.md @@ -1,9 +1,16 @@ # WASI Tests -Compile with clang and `wasm32-wasi` target. The clang version used must be -built with wasi-libc. You can specify the location for clang and the sysroot -if needed when running make: +Compile with clang and `wasm32-wasi` target by using the wasi-sdk +[version 20](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-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: ```bash -make CC=/usr/local/opt/llvm/bin/clang SYSROOT=/path/to/wasi-libc/sysroot +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. diff --git a/test/wasi/c/clock_getres.c b/test/wasi/c/clock_getres.c index eaac02c665b9f2..2d72c5305f33af 100644 --- a/test/wasi/c/clock_getres.c +++ b/test/wasi/c/clock_getres.c @@ -10,8 +10,11 @@ int main() { assert(r == 0); r = clock_getres(CLOCK_MONOTONIC, &ts); assert(r == 0); - r = clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts); - assert(r == 0); - r = clock_getres(CLOCK_THREAD_CPUTIME_ID, &ts); - assert(r == 0); + // don't run these tests until + // https://github.com/WebAssembly/wasi-libc/issues/266 + // is resolved + // r = clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts); + // assert(r == 0); + // r = clock_getres(CLOCK_THREAD_CPUTIME_ID, &ts); + // assert(r == 0); } diff --git a/test/wasi/c/poll.c b/test/wasi/c/poll.c index 9afb6325a98a03..bd2ff62613ea23 100644 --- a/test/wasi/c/poll.c +++ b/test/wasi/c/poll.c @@ -10,11 +10,11 @@ int main(void) { time_t before, now; int ret; char* platform; - int is_aix; + int is_aix_or_os400; int is_win; platform = getenv("NODE_PLATFORM"); - is_aix = platform != NULL && 0 == strcmp(platform, "aix"); + is_aix_or_os400 = platform != NULL && (0 == strcmp(platform, "aix") || 0 == strcmp(platform, "os400")); is_win = platform != NULL && 0 == strcmp(platform, "win32"); // Test sleep() behavior. @@ -64,7 +64,7 @@ int main(void) { ret = poll(fds, 1, 2000); assert(ret == 1); - if (is_aix) + if (is_aix_or_os400) assert(fds[0].revents == POLLIN); else assert(fds[0].revents == (POLLHUP | POLLIN)); diff --git a/test/wasi/c/readdir.c b/test/wasi/c/readdir.c index a18ae5de34eb8f..192a00474aab6a 100644 --- a/test/wasi/c/readdir.c +++ b/test/wasi/c/readdir.c @@ -14,7 +14,6 @@ int main() { platform = getenv("NODE_PLATFORM"); assert(platform != NULL); - has_d_type = (0 != strcmp(platform, "aix") && 0 != strcmp(platform, "sunos")); dir = opendir("/sandbox"); assert(dir != NULL); @@ -25,17 +24,9 @@ int main() { if (strcmp(entry->d_name, "input.txt") == 0 || strcmp(entry->d_name, "input2.txt") == 0 || strcmp(entry->d_name, "notadir") == 0) { - if (has_d_type) { assert(entry->d_type == DT_REG); - } else { - assert(entry->d_type == DT_UNKNOWN); - } } else if (strcmp(entry->d_name, "subdir") == 0) { - if (has_d_type) { assert(entry->d_type == DT_DIR); - } else { - assert(entry->d_type == DT_UNKNOWN); - } } else { assert("unexpected file"); } diff --git a/test/wasi/wasm/cant_dotdot.wasm b/test/wasi/wasm/cant_dotdot.wasm index b078dfca1afbc9..75e36467a2252d 100755 Binary files a/test/wasi/wasm/cant_dotdot.wasm and b/test/wasi/wasm/cant_dotdot.wasm differ diff --git a/test/wasi/wasm/clock_getres.wasm b/test/wasi/wasm/clock_getres.wasm index 9d47599c7b9478..67e0a46564e667 100755 Binary files a/test/wasi/wasm/clock_getres.wasm and b/test/wasi/wasm/clock_getres.wasm differ diff --git a/test/wasi/wasm/create_symlink.wasm b/test/wasi/wasm/create_symlink.wasm index 291f17eedcfa76..89a24c50ca3146 100755 Binary files a/test/wasi/wasm/create_symlink.wasm and b/test/wasi/wasm/create_symlink.wasm differ diff --git a/test/wasi/wasm/exitcode.wasm b/test/wasi/wasm/exitcode.wasm index 0472e62d851095..853e0e26fa5f71 100755 Binary files a/test/wasi/wasm/exitcode.wasm and b/test/wasi/wasm/exitcode.wasm differ diff --git a/test/wasi/wasm/fd_prestat_get_refresh.wasm b/test/wasi/wasm/fd_prestat_get_refresh.wasm index d645b42c806791..251fb9166682b4 100755 Binary files a/test/wasi/wasm/fd_prestat_get_refresh.wasm and b/test/wasi/wasm/fd_prestat_get_refresh.wasm differ diff --git a/test/wasi/wasm/follow_symlink.wasm b/test/wasi/wasm/follow_symlink.wasm index b79242eb13141a..b8d0d0eb125d58 100755 Binary files a/test/wasi/wasm/follow_symlink.wasm and b/test/wasi/wasm/follow_symlink.wasm differ diff --git a/test/wasi/wasm/freopen.wasm b/test/wasi/wasm/freopen.wasm index 5f774d782332f2..18aef3a8d5b1e7 100755 Binary files a/test/wasi/wasm/freopen.wasm and b/test/wasi/wasm/freopen.wasm differ diff --git a/test/wasi/wasm/ftruncate.wasm b/test/wasi/wasm/ftruncate.wasm index 60542eeb6a0ff6..ff0591ad8e3912 100755 Binary files a/test/wasi/wasm/ftruncate.wasm and b/test/wasi/wasm/ftruncate.wasm differ diff --git a/test/wasi/wasm/getentropy.wasm b/test/wasi/wasm/getentropy.wasm index f9e4cb52869892..3f40499255b74f 100755 Binary files a/test/wasi/wasm/getentropy.wasm and b/test/wasi/wasm/getentropy.wasm differ diff --git a/test/wasi/wasm/getrusage.wasm b/test/wasi/wasm/getrusage.wasm index ff131ee42a09b6..fb0197fde2c997 100755 Binary files a/test/wasi/wasm/getrusage.wasm and b/test/wasi/wasm/getrusage.wasm differ diff --git a/test/wasi/wasm/gettimeofday.wasm b/test/wasi/wasm/gettimeofday.wasm index 408a5cfc9ef209..8bb6733251f2b8 100755 Binary files a/test/wasi/wasm/gettimeofday.wasm and b/test/wasi/wasm/gettimeofday.wasm differ diff --git a/test/wasi/wasm/link.wasm b/test/wasi/wasm/link.wasm index 4a9719df3035d5..fbc79e1d88368e 100755 Binary files a/test/wasi/wasm/link.wasm and b/test/wasi/wasm/link.wasm differ diff --git a/test/wasi/wasm/main_args.wasm b/test/wasi/wasm/main_args.wasm index 1e14b8351b71e6..3245c8410532f2 100755 Binary files a/test/wasi/wasm/main_args.wasm and b/test/wasi/wasm/main_args.wasm differ diff --git a/test/wasi/wasm/notdir.wasm b/test/wasi/wasm/notdir.wasm index ae22933603d049..4d63ef3cd8f6f5 100755 Binary files a/test/wasi/wasm/notdir.wasm and b/test/wasi/wasm/notdir.wasm differ diff --git a/test/wasi/wasm/poll.wasm b/test/wasi/wasm/poll.wasm index 22c0fe859d7ad3..07e09ddd39abc6 100755 Binary files a/test/wasi/wasm/poll.wasm and b/test/wasi/wasm/poll.wasm differ diff --git a/test/wasi/wasm/preopen_populates.wasm b/test/wasi/wasm/preopen_populates.wasm index 1236bbe1cc6e6e..21b23a241c5f28 100755 Binary files a/test/wasi/wasm/preopen_populates.wasm and b/test/wasi/wasm/preopen_populates.wasm differ diff --git a/test/wasi/wasm/read_file.wasm b/test/wasi/wasm/read_file.wasm index bc1433e09e961e..1027a76adc3d21 100755 Binary files a/test/wasi/wasm/read_file.wasm and b/test/wasi/wasm/read_file.wasm differ diff --git a/test/wasi/wasm/read_file_twice.wasm b/test/wasi/wasm/read_file_twice.wasm index 6b73ae11309fde..469b5c815b666a 100755 Binary files a/test/wasi/wasm/read_file_twice.wasm and b/test/wasi/wasm/read_file_twice.wasm differ diff --git a/test/wasi/wasm/readdir.wasm b/test/wasi/wasm/readdir.wasm index c315d2d5b8e87e..40626f7240b268 100755 Binary files a/test/wasi/wasm/readdir.wasm and b/test/wasi/wasm/readdir.wasm differ diff --git a/test/wasi/wasm/sock.wasm b/test/wasi/wasm/sock.wasm index 9fdba111a23ca2..905bf605a703f4 100755 Binary files a/test/wasi/wasm/sock.wasm and b/test/wasi/wasm/sock.wasm differ diff --git a/test/wasi/wasm/stat.wasm b/test/wasi/wasm/stat.wasm index 6f924b74d9b22c..4a9c94095d74a7 100755 Binary files a/test/wasi/wasm/stat.wasm and b/test/wasi/wasm/stat.wasm differ diff --git a/test/wasi/wasm/stdin.wasm b/test/wasi/wasm/stdin.wasm index f9ea0fd336d50e..1560949d8cb78f 100755 Binary files a/test/wasi/wasm/stdin.wasm and b/test/wasi/wasm/stdin.wasm differ diff --git a/test/wasi/wasm/symlink_escape.wasm b/test/wasi/wasm/symlink_escape.wasm index 4ff589da7d438c..21c459b78b82d4 100755 Binary files a/test/wasi/wasm/symlink_escape.wasm and b/test/wasi/wasm/symlink_escape.wasm differ diff --git a/test/wasi/wasm/symlink_loop.wasm b/test/wasi/wasm/symlink_loop.wasm index 409102d7ee21a0..4f8f1643101ca9 100755 Binary files a/test/wasi/wasm/symlink_loop.wasm and b/test/wasi/wasm/symlink_loop.wasm differ diff --git a/test/wasi/wasm/write_file.wasm b/test/wasi/wasm/write_file.wasm index 005c3da09de043..8a87d526db0113 100755 Binary files a/test/wasi/wasm/write_file.wasm and b/test/wasi/wasm/write_file.wasm differ