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ยง
- Chain
- Descriptor chain that can be published in a
FakeQueue
- Chain
Builder - Builder for a
Chain
- Chain
Data Iter - Iterator for the data in a
UsedChain
- Fake
Queue - Simulates driver side interactions of a queue for facilitating tests.
- Identity
Driver Mem - Implementation of
crate::mem::DriverMem
assuming the identity translation. - Test
Queue - Wraps common state needed for writing test code with a
FakeQueue
. - Used
Chain - Represents a chain returned by a device.