From bae1a5693dff7f217631336578dac8e99a490fe1 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Fri, 7 May 2021 16:19:50 -0700 Subject: [PATCH] 10ms here, and let it timeout in addition to ready? --- crates/wasi-common/tokio/tests/poll_oneoff.rs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/crates/wasi-common/tokio/tests/poll_oneoff.rs b/crates/wasi-common/tokio/tests/poll_oneoff.rs index bf932325fe..fa04f4604e 100644 --- a/crates/wasi-common/tokio/tests/poll_oneoff.rs +++ b/crates/wasi-common/tokio/tests/poll_oneoff.rs @@ -40,7 +40,7 @@ async fn empty_file_readable() -> Result<(), Error> { clocks .monotonic .now(clocks.monotonic.resolution()) - .checked_add(Duration::from_millis(5)) + .checked_add(Duration::from_millis(10)) .unwrap(), clocks.monotonic.resolution(), Userdata::from(0), @@ -49,11 +49,10 @@ async fn empty_file_readable() -> Result<(), Error> { let events = poll.results(); - assert_eq!(events.len(), 1, "expected 1 event, got: {:?}", events); - match events[0] { + match events.get(0).expect("at least one event") { (SubscriptionResult::Read(Ok((1, flags))), ud) => { - assert_eq!(flags, RwEventFlags::empty()); - assert_eq!(ud, Userdata::from(123)); + assert_eq!(*flags, RwEventFlags::empty()); + assert_eq!(*ud, Userdata::from(123)); } _ => panic!("expected (Read(Ok(1, empty), 123), got: {:?}", events[0]), } @@ -83,7 +82,7 @@ async fn empty_file_writable() -> Result<(), Error> { clocks .monotonic .now(clocks.monotonic.resolution()) - .checked_add(Duration::from_millis(5)) + .checked_add(Duration::from_millis(10)) .unwrap(), clocks.monotonic.resolution(), Userdata::from(0), @@ -92,11 +91,10 @@ async fn empty_file_writable() -> Result<(), Error> { let events = poll.results(); - assert_eq!(events.len(), 1); - match events[0] { + match events.get(0).expect("at least one event") { (SubscriptionResult::Write(Ok((0, flags))), ud) => { - assert_eq!(flags, RwEventFlags::empty()); - assert_eq!(ud, Userdata::from(123)); + assert_eq!(*flags, RwEventFlags::empty()); + assert_eq!(*ud, Userdata::from(123)); } _ => panic!(""), } @@ -111,7 +109,7 @@ async fn stdio_readable() -> Result<(), Error> { let deadline = clocks .monotonic .now(clocks.monotonic.resolution()) - .checked_add(Duration::from_millis(5)) + .checked_add(Duration::from_millis(10)) .unwrap(); let mut waiting_on: HashMap> = vec![