#![allow(missing_docs)]
use std::thread;
use std::time::Duration;
use wireshift_core::backend::{Backend, BackendSubmission};
use wireshift_core::config::RingConfig;
use wireshift_core::op::OpDescriptor;
use wireshift_uring::UringBackend;
#[test]
fn test_crash_full_completion_queue() {
let config = RingConfig::default().with_queue_depth(128);
let (tx, rx) = std::sync::mpsc::channel();
let backend = UringBackend::new(&config, tx).unwrap();
for i in 0..100 {
let submission = BackendSubmission { timeout: None,
id: i as u64,
descriptor: OpDescriptor::Nop,
};
let _ = backend.submit(submission);
}
thread::sleep(Duration::from_millis(100));
let submission = BackendSubmission { timeout: None,
id: 9999,
descriptor: OpDescriptor::Nop,
};
let submit_res = backend.submit(submission);
assert!(
submit_res.is_ok(),
"Backend failed to accept new submission after previous burst"
);
}