Module virtio_device::fake_queue
source · Expand description
Fake queue for simulating driver interactions in unittests
To facilitate writing unittests it is useful to manipulate the queues from the perspective of a a driver. This module contains helpers that allow for:
- Building simple descriptor chains
- Publishing the build descriptors in the available ring
- Receiving written descriptors from the used ring
This functionality centers around the
FakeQueue
implementation.
For simplicity of writing tests the TestQueue
struct packages together all the pieces
commonly needed to write a test.
This module is available as, in addition to be used for writing the unittests for this library, it can also be used for writing unittests for actual virtio device drivers without needing a guest environment.
Structs§
- Descriptor chain that can be published in a
FakeQueue
- Builder for a
Chain
- Iterator for the data in a
UsedChain
- Simulates driver side interactions of a queue for facilitating tests.
- Implementation of
crate::mem::DriverMem
assuming the identity translation. - Wraps common state needed for writing test code with a
FakeQueue
. - Represents a chain returned by a device.