-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mocking of IO #18
Comments
This sounds like it would be very interesting for deterministic simulation testing! For creating fake SQEs/CQEs, would that be something which could be done within the |
Don't mean to barge in but I believe at least mock CQEs are supported by |
I think SQEs would be the tricky one. The only way to get a valid Is the goal to avoid requiring a valid |
@mxxo Good point! I’m not super familiar with the requirements of |
You're right for the general case but I think in this case we don't need any extra annotations because // pub struct SQEs<'ring> {
// sqes: slice::IterMut<'ring, uring_sys::io_uring_sqe>,
// }
use iou::SQEs;
struct MockSqes<'ring> {
sqes: std::slice::IterMut<'ring, uring_sys::io_uring_sqe>,
}
impl<'ring> MockSqes<'ring> {
fn as_sqes(&mut self) -> &mut SQEs {
unsafe { &mut *(self as *mut MockSqes as *mut SQEs) }
}
} I don't know if this is a great implementation idea for a mock driver in general though. |
It occurred to me this monring that io-uring is exceptionally mockable as far as IO interfaces go, because it is mostly just a data structure. With changes to make it easier to create fake SQEs and CQEs, a mock driver for testing that does no actual IO would not be difficult to build.
The text was updated successfully, but these errors were encountered: