mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
io_uring: use WaitContext
BUG=b:213153157 TEST=presubmit Change-Id: I5875151109f391fbd217269c864abe7d32b7b92e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626209 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Noah Gold <nkgold@google.com> Auto-Submit: Vikram Auradkar <auradkar@google.com> Commit-Queue: Vikram Auradkar <auradkar@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
d724d41e19
commit
95707cfa9c
1 changed files with 6 additions and 5 deletions
|
@ -892,7 +892,7 @@ mod tests {
|
|||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use base::{pipe, EventContext};
|
||||
use base::{pipe, WaitContext};
|
||||
use sync::{Condvar, Mutex};
|
||||
use tempfile::{tempfile, TempDir};
|
||||
|
||||
|
@ -1062,11 +1062,11 @@ mod tests {
|
|||
f.write_all(&buf).unwrap();
|
||||
f.write_all(&buf).unwrap();
|
||||
|
||||
let ctx: EventContext<u64> = EventContext::build_with(&[(&uring, 1)]).unwrap();
|
||||
let ctx: WaitContext<u64> = WaitContext::build_with(&[(&uring, 1)]).unwrap();
|
||||
{
|
||||
// Test that the uring context isn't readable before any events are complete.
|
||||
let events = ctx.wait_timeout(Duration::from_millis(1)).unwrap();
|
||||
assert!(events.iter_readable().next().is_none());
|
||||
assert!(events.iter().next().is_none());
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
@ -1077,8 +1077,9 @@ mod tests {
|
|||
uring.submit().unwrap();
|
||||
// Poll for completion with epoll.
|
||||
let events = ctx.wait().unwrap();
|
||||
let event = events.iter_readable().next().unwrap();
|
||||
assert_eq!(event.token(), 1);
|
||||
let event = events.iter().next().unwrap();
|
||||
assert!(event.is_readable);
|
||||
assert_eq!(event.token, 1);
|
||||
let (user_data, res) = uring.wait().unwrap().next().unwrap();
|
||||
assert_eq!(user_data, 55_u64);
|
||||
assert_eq!(res.unwrap(), buf.len() as u32);
|
||||
|
|
Loading…
Reference in a new issue