10ms here, and let it timeout in addition to ready?

This commit is contained in:
Pat Hickey
2021-05-07 16:19:50 -07:00
parent 74e9b385df
commit bae1a5693d

View File

@@ -40,7 +40,7 @@ async fn empty_file_readable() -> Result<(), Error> {
clocks clocks
.monotonic .monotonic
.now(clocks.monotonic.resolution()) .now(clocks.monotonic.resolution())
.checked_add(Duration::from_millis(5)) .checked_add(Duration::from_millis(10))
.unwrap(), .unwrap(),
clocks.monotonic.resolution(), clocks.monotonic.resolution(),
Userdata::from(0), Userdata::from(0),
@@ -49,11 +49,10 @@ async fn empty_file_readable() -> Result<(), Error> {
let events = poll.results(); let events = poll.results();
assert_eq!(events.len(), 1, "expected 1 event, got: {:?}", events); match events.get(0).expect("at least one event") {
match events[0] {
(SubscriptionResult::Read(Ok((1, flags))), ud) => { (SubscriptionResult::Read(Ok((1, flags))), ud) => {
assert_eq!(flags, RwEventFlags::empty()); assert_eq!(*flags, RwEventFlags::empty());
assert_eq!(ud, Userdata::from(123)); assert_eq!(*ud, Userdata::from(123));
} }
_ => panic!("expected (Read(Ok(1, empty), 123), got: {:?}", events[0]), _ => panic!("expected (Read(Ok(1, empty), 123), got: {:?}", events[0]),
} }
@@ -83,7 +82,7 @@ async fn empty_file_writable() -> Result<(), Error> {
clocks clocks
.monotonic .monotonic
.now(clocks.monotonic.resolution()) .now(clocks.monotonic.resolution())
.checked_add(Duration::from_millis(5)) .checked_add(Duration::from_millis(10))
.unwrap(), .unwrap(),
clocks.monotonic.resolution(), clocks.monotonic.resolution(),
Userdata::from(0), Userdata::from(0),
@@ -92,11 +91,10 @@ async fn empty_file_writable() -> Result<(), Error> {
let events = poll.results(); let events = poll.results();
assert_eq!(events.len(), 1); match events.get(0).expect("at least one event") {
match events[0] {
(SubscriptionResult::Write(Ok((0, flags))), ud) => { (SubscriptionResult::Write(Ok((0, flags))), ud) => {
assert_eq!(flags, RwEventFlags::empty()); assert_eq!(*flags, RwEventFlags::empty());
assert_eq!(ud, Userdata::from(123)); assert_eq!(*ud, Userdata::from(123));
} }
_ => panic!(""), _ => panic!(""),
} }
@@ -111,7 +109,7 @@ async fn stdio_readable() -> Result<(), Error> {
let deadline = clocks let deadline = clocks
.monotonic .monotonic
.now(clocks.monotonic.resolution()) .now(clocks.monotonic.resolution())
.checked_add(Duration::from_millis(5)) .checked_add(Duration::from_millis(10))
.unwrap(); .unwrap();
let mut waiting_on: HashMap<u64, Box<dyn WasiFile>> = vec![ let mut waiting_on: HashMap<u64, Box<dyn WasiFile>> = vec![