Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: split wasi poll test for windows #52538

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/wasi/c/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ int main(void) {
assert(ret == 0);
assert(now - before >= 2);

// V8 has a bug that allows unsupported parts of this test to run,
// causing the test to fail. poll_win.c is a workaround.
// https://github.com/nodejs/node/issues/51822
// The rest of the test is unsupported on Windows.
if (is_win)
return 0;
Expand Down
26 changes: 26 additions & 0 deletions test/wasi/c/poll_win.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <assert.h>
#include <poll.h>
#include <time.h>
#include <unistd.h>

int main(void) {
struct pollfd fds[4];
time_t before, now;
int ret;

// Test sleep() behavior.
time(&before);
sleep(1);
time(&now);
assert(now - before >= 1);

// Test poll() timeout behavior.
fds[0] = (struct pollfd){.fd = -1, .events = 0, .revents = 0};
time(&before);
ret = poll(fds, 1, 2000);
time(&now);
assert(ret == 0);
assert(now - before >= 2);

return 0;
}
2 changes: 1 addition & 1 deletion test/wasi/test-wasi-poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
require('../common');
const { testWasiPreview1 } = require('../common/wasi');

testWasiPreview1(['poll']);
testWasiPreview1([process.platform === 'win32' ? 'poll_win' : 'poll']);
4 changes: 0 additions & 4 deletions test/wasi/wasi.status
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ prefix wasi

[true] # This section applies to all platforms

# Windows on ARM
[$system==win32 && $arch==arm64]
# https://github.com/nodejs/node/issues/51822
test-wasi-poll: PASS, FLAKY
Binary file added test/wasi/wasm/poll_win.wasm
Binary file not shown.
Loading