Skip to content

Commit 9cb8eb7

Browse files
authored
wasi: fix up wasi tests for ibmi
ibmi now reports os400 instead of aix - update platform check in poll to allow for os400 - update wasi-sdk level to 20 - document the level of wasi-sdk used to compile the tests - remove platform check in readdir test as it does not seem to be needed with wasi-sdk version 20 - comment out tests for some clocks which are no longer available when compiling with wasi-sdk level 20. These may be added back after WebAssembly/wasi-libc#266 is resolved. Signed-off-by: Michael Dawson <[email protected]> PR-URL: #49953 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent b1ada0a commit 9cb8eb7

29 files changed

+21
-20
lines changed

β€Žtest/wasi/README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# WASI Tests
22

3-
Compile with clang and `wasm32-wasi` target. The clang version used must be
4-
built with wasi-libc. You can specify the location for clang and the sysroot
5-
if needed when running make:
3+
Compile with clang and `wasm32-wasi` target by using the wasi-sdk
4+
[version 20](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-20)
5+
6+
Install wasi-sdk and then set WASI\_SDK\_PATH to the root of the install.
7+
8+
You can then rebuild the wasm for the tests by running:
69

710
```bash
8-
make CC=/usr/local/opt/llvm/bin/clang SYSROOT=/path/to/wasi-libc/sysroot
11+
make CC=${WASI_SDK_PATH}/bin/clang SYSROOT=${WASI_SDK_PATH}/share/wasi-sysroot
912
```
13+
14+
If you update the version of the wasi-sdk to be used for the compile
15+
remove all of the \*.wasm files in the wasm directory to ensure
16+
you rebuild/test all of the tests with the new version.

β€Žtest/wasi/c/clock_getres.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ int main() {
1010
assert(r == 0);
1111
r = clock_getres(CLOCK_MONOTONIC, &ts);
1212
assert(r == 0);
13-
r = clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts);
14-
assert(r == 0);
15-
r = clock_getres(CLOCK_THREAD_CPUTIME_ID, &ts);
16-
assert(r == 0);
13+
// don't run these tests until
14+
// https://github.com/WebAssembly/wasi-libc/issues/266
15+
// is resolved
16+
// r = clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts);
17+
// assert(r == 0);
18+
// r = clock_getres(CLOCK_THREAD_CPUTIME_ID, &ts);
19+
// assert(r == 0);
1720
}

β€Žtest/wasi/c/poll.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ int main(void) {
1010
time_t before, now;
1111
int ret;
1212
char* platform;
13-
int is_aix;
13+
int is_aix_or_os400;
1414
int is_win;
1515

1616
platform = getenv("NODE_PLATFORM");
17-
is_aix = platform != NULL && 0 == strcmp(platform, "aix");
17+
is_aix_or_os400 = platform != NULL && (0 == strcmp(platform, "aix") || 0 == strcmp(platform, "os400"));
1818
is_win = platform != NULL && 0 == strcmp(platform, "win32");
1919

2020
// Test sleep() behavior.
@@ -64,7 +64,7 @@ int main(void) {
6464
ret = poll(fds, 1, 2000);
6565
assert(ret == 1);
6666

67-
if (is_aix)
67+
if (is_aix_or_os400)
6868
assert(fds[0].revents == POLLIN);
6969
else
7070
assert(fds[0].revents == (POLLHUP | POLLIN));

β€Žtest/wasi/c/readdir.c

-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ int main() {
1414

1515
platform = getenv("NODE_PLATFORM");
1616
assert(platform != NULL);
17-
has_d_type = (0 != strcmp(platform, "aix") && 0 != strcmp(platform, "sunos"));
1817

1918
dir = opendir("/sandbox");
2019
assert(dir != NULL);
@@ -25,17 +24,9 @@ int main() {
2524
if (strcmp(entry->d_name, "input.txt") == 0 ||
2625
strcmp(entry->d_name, "input2.txt") == 0 ||
2726
strcmp(entry->d_name, "notadir") == 0) {
28-
if (has_d_type) {
2927
assert(entry->d_type == DT_REG);
30-
} else {
31-
assert(entry->d_type == DT_UNKNOWN);
32-
}
3328
} else if (strcmp(entry->d_name, "subdir") == 0) {
34-
if (has_d_type) {
3529
assert(entry->d_type == DT_DIR);
36-
} else {
37-
assert(entry->d_type == DT_UNKNOWN);
38-
}
3930
} else {
4031
assert("unexpected file");
4132
}

β€Žtest/wasi/wasm/cant_dotdot.wasm

-534 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/clock_getres.wasm

-156 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/create_symlink.wasm

-536 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/exitcode.wasm

-1 Bytes
Binary file not shown.
-1 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/follow_symlink.wasm

-534 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/freopen.wasm

-534 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/ftruncate.wasm

-553 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/getentropy.wasm

40 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/getrusage.wasm

38 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/gettimeofday.wasm

44 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/link.wasm

-553 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/main_args.wasm

-532 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/notdir.wasm

-535 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/poll.wasm

-570 Bytes
Binary file not shown.
-1 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/read_file.wasm

-534 Bytes
Binary file not shown.
-534 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/readdir.wasm

-65 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/sock.wasm

-858 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/stat.wasm

-561 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/stdin.wasm

-3 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/symlink_escape.wasm

-534 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/symlink_loop.wasm

-534 Bytes
Binary file not shown.

β€Žtest/wasi/wasm/write_file.wasm

-534 Bytes
Binary file not shown.

0 commit comments

Comments
Β (0)