Merge pull request #552 from marmistrz/poll

Minimal viable implementation of poll_oneoff for Windows
This commit is contained in:
Peter Huene
2020-01-23 09:30:21 -08:00
committed by GitHub
5 changed files with 316 additions and 14 deletions

View File

@@ -45,10 +45,6 @@ unsafe fn test_timeout() {
}];
let out = poll_oneoff_impl(&r#in, 1);
let event = &out[0];
assert_eq!(
event.userdata, CLOCK_ID,
"the event.userdata should contain clock_id specified by the user"
);
assert_eq!(
event.error,
wasi::ERRNO_SUCCESS,
@@ -59,6 +55,10 @@ unsafe fn test_timeout() {
wasi::EVENTTYPE_CLOCK,
"the event.type should equal clock"
);
assert_eq!(
event.userdata, CLOCK_ID,
"the event.userdata should contain clock_id specified by the user"
);
}
unsafe fn test_stdin_read() {
@@ -77,6 +77,7 @@ unsafe fn test_stdin_read() {
r#type: wasi::EVENTTYPE_CLOCK,
u: wasi::SubscriptionU { clock },
},
// Make sure that timeout is returned only once even if there are multiple read events
wasi::Subscription {
userdata: 1,
r#type: wasi::EVENTTYPE_FD_READ,
@@ -85,10 +86,6 @@ unsafe fn test_stdin_read() {
];
let out = poll_oneoff_impl(&r#in, 1);
let event = &out[0];
assert_eq!(
event.userdata, CLOCK_ID,
"the event.userdata should contain clock_id specified by the user"
);
assert_eq!(
event.error,
wasi::ERRNO_SUCCESS,
@@ -99,6 +96,10 @@ unsafe fn test_stdin_read() {
wasi::EVENTTYPE_CLOCK,
"the event.type should equal clock"
);
assert_eq!(
event.userdata, CLOCK_ID,
"the event.userdata should contain clock_id specified by the user"
);
}
unsafe fn test_stdout_stderr_write() {