mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: split wasi poll test for windows
PR-URL: https://github.com/nodejs/node/pull/52538 Fixes: https://github.com/nodejs/node/issues/51822 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
parent
97627da32b
commit
b41347e496
@ -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;
|
||||
|
26
test/wasi/c/poll_win.c
Normal file
26
test/wasi/c/poll_win.c
Normal file
@ -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,4 +2,4 @@
|
||||
require('../common');
|
||||
const { testWasiPreview1 } = require('../common/wasi');
|
||||
|
||||
testWasiPreview1(['poll']);
|
||||
testWasiPreview1([process.platform === 'win32' ? 'poll_win' : 'poll']);
|
||||
|
@ -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
|
||||
|
BIN
test/wasi/wasm/poll_win.wasm
Normal file
BIN
test/wasi/wasm/poll_win.wasm
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user