diff --git a/io_uring/src/uring.rs b/io_uring/src/uring.rs index fc85ba9406..d67447379f 100644 --- a/io_uring/src/uring.rs +++ b/io_uring/src/uring.rs @@ -1423,7 +1423,9 @@ mod tests { ); } + // TODO(b/183722981): Fix and re-enable test #[test] + #[ignore] fn multi_thread_submit_and_complete() { const NUM_SUBMITTERS: usize = 7; const NUM_COMPLETERS: usize = 3; @@ -1504,13 +1506,30 @@ mod tests { t.join().unwrap(); } - // Make sure we didn't submit more entries than expected. - assert_eq!(uring.complete_ring.num_ready(), 0); + // Now that all submitters are finished, add NOPs to wake up any completers blocked on the + // syscall. + for i in 0..NUM_COMPLETERS { + uring + .add_nop((NUM_SUBMITTERS * ITERATIONS + i) as UserData) + .unwrap(); + } + uring.submit().unwrap(); + + for t in threads { + t.join().unwrap(); + } + + // Make sure we didn't submit more entries than expected. Only the last few NOPs added to + // wake up the completer threads may still be in the completion ring. + assert!(uring.complete_ring.num_ready() <= NUM_COMPLETERS as u32); assert_eq!( in_flight.lock().abs() as u32 + uring.complete_ring.num_ready(), - 0 + NUM_COMPLETERS as u32 + ); + assert_eq!(uring.submit_ring.lock().added, 0); + assert_eq!( + uring.stats.total_ops.load(Ordering::Relaxed), + (NUM_SUBMITTERS * ITERATIONS + NUM_COMPLETERS) as u64 ); - - // Leave the completer threads hanging to be cleaned up by the OS. } }