diff --git a/test/wasi/README.md b/test/wasi/README.md index b99b4fa76d3993c..cf1d137f9a47d95 100644 --- a/test/wasi/README.md +++ b/test/wasi/README.md @@ -1,9 +1,15 @@ # 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 eaac02c665b9f24..2d72c5305f33afe 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 9afb6325a98a032..bd2ff62613ea236 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 a18ae5de34eb8fb..192a00474aab6a4 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 b078dfca1afbc96..75e36467a2252db 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 9d47599c7b94789..67e0a46564e667d 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 291f17eedcfa767..89a24c50ca31466 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 0472e62d851095e..853e0e26fa5f710 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 d645b42c8067915..251fb9166682b41 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 b79242eb13141ad..b8d0d0eb125d584 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 5f774d782332f28..18aef3a8d5b1e77 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 60542eeb6a0ff67..ff0591ad8e3912c 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 f9e4cb52869892a..3f40499255b74f5 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 ff131ee42a09b6d..fb0197fde2c9973 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 408a5cfc9ef209a..8bb6733251f2b84 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 4a9719df3035d54..fbc79e1d88368e0 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 1e14b8351b71e6b..3245c8410532f2d 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 ae22933603d0493..4d63ef3cd8f6f58 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 22c0fe859d7ad39..07e09ddd39abc65 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 1236bbe1cc6e6e0..21b23a241c5f287 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 bc1433e09e961e6..1027a76adc3d21b 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 6b73ae11309fde5..469b5c815b666a2 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 c315d2d5b8e87ee..40626f7240b268d 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 9fdba111a23ca22..905bf605a703f4f 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 6f924b74d9b22cc..4a9c94095d74a79 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 f9ea0fd336d50ee..1560949d8cb78fb 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 4ff589da7d438c8..21c459b78b82d44 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 409102d7ee21a0f..4f8f1643101ca9e 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 005c3da09de043b..8a87d526db01131 100755 Binary files a/test/wasi/wasm/write_file.wasm and b/test/wasi/wasm/write_file.wasm differ