Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9cb8eb7

Browse filesBrowse 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 <midawson@redhat.com> PR-URL: #49953 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent b1ada0a commit 9cb8eb7
Copy full SHA for 9cb8eb7
Expand file treeCollapse file tree

29 files changed

+21
-20
lines changed
Open diff view settings
Collapse file

‎test/wasi/README.md‎

Copy file name to clipboard
+11-4Lines changed: 11 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
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.
Collapse file

‎test/wasi/c/clock_getres.c‎

Copy file name to clipboardExpand all lines: test/wasi/c/clock_getres.c
+7-4Lines changed: 7 additions & 4 deletions
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
}
Collapse file

‎test/wasi/c/poll.c‎

Copy file name to clipboardExpand all lines: test/wasi/c/poll.c
+3-3Lines changed: 3 additions & 3 deletions
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));
Collapse file

‎test/wasi/c/readdir.c‎

Copy file name to clipboardExpand all lines: test/wasi/c/readdir.c
-9Lines changed: 0 additions & 9 deletions
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
}
Collapse file

‎test/wasi/wasm/cant_dotdot.wasm‎

Copy file name to clipboard
-534 Bytes
Binary file not shown.
Collapse file

‎test/wasi/wasm/clock_getres.wasm‎

Copy file name to clipboard
-156 Bytes
Binary file not shown.
Collapse file

‎test/wasi/wasm/create_symlink.wasm‎

Copy file name to clipboard
-536 Bytes
Binary file not shown.
Collapse file

‎test/wasi/wasm/exitcode.wasm‎

Copy file name to clipboard
-1 Bytes
Binary file not shown.
Collapse file
-1 Bytes
Binary file not shown.
Collapse file

‎test/wasi/wasm/follow_symlink.wasm‎

Copy file name to clipboard
-534 Bytes
Binary file not shown.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.