-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: split wasi poll test for windows
PR-URL: #52538 Fixes: #51822 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
- Loading branch information
1 parent
83b82ae
commit e567005
Showing
5 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.