Skip to main content

Module test_helpers

Module test_helpers 

Source
Expand description

Shared test helpers for writing integration tests that drive virtio devices through descriptor rings.

These helpers manipulate split virtqueue descriptor tables, available rings, and used rings in guest memory — the same operations a guest driver would perform.

Functions§

init_avail_ring
Initialize an avail ring (flags=0, idx=0).
init_used_ring
Initialize a used ring (flags=0, idx=0).
make_available
Make a descriptor index available in the avail ring and bump the index.
read_used
Read the next used ring entry, returning (desc_id, bytes_written) or None if no new entries are available.
read_used_entry
Read a used ring entry (id, len) at the given ring index.
read_used_idx
Read the used ring index.
wait_for_used
Wait for the next used ring entry, polling with a timeout.
write_descriptor
Write a split virtio descriptor at the given descriptor table base.