Documentation
¶
Overview ¶
Package guest has functions for use in tests running in VM guests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectKernelCoverage ¶
func CollectKernelCoverage()
CollectKernelCoverage saves the kernel coverage report to a tar file.
Assumes that the `vmmount` command has been used to mount the kernel coverage 9P shared dir at /mount/9p/kcoverage.
func Mount9PDir ¶
func Mount9PDir(dir, tag string) (*mount.MountPoint, error)
Mount9PDir mounts a directory shared as tag at dir. It creates dir if it does not exist.
func SkipIfInVM ¶
SkipIfInVM skips the test if it is running in a vmtest-started VM.
The presence of VMTEST_IN_GUEST=1 env var (which can be passed on the kernel commandline, using qemu.WithVmtestIdent) is used to determine this.
func SkipIfNotInVM ¶
SkipIfNotInVM skips the test if it is not running in a vmtest-started VM.
The presence of VMTEST_IN_GUEST=1 env var (which can be passed on the kernel commandline, using qemu.WithVmtestIdent) is used to determine this.
func VirtioSerialDevice ¶
VirtioSerialDevice looks up the device path for the given virtio-serial name.
The name would be configured in the QEMU command-line (or e.g. with qemu.EventChannel).
Types ¶
type Emitter ¶
type Emitter[T any] struct { // contains filtered or unexported fields }
Emitter is an event channel emitter.
func EventChannel ¶
EventChannel opens an event channel to the host over the given device.
Callers must call Close on Emitter to publish a final "done" event to signal the host no more events are coming. If the "done" event is not published, qemu.EventChannel is configured to return an error on VM exit on the host.
T should be the type of a JSON event being sent, matching the host configuration on qemu.EventChannel reading from this channel.
func SerialEventChannel ¶
SerialEventChannel opens an event channel to the host over virtio-serial with the given virtio-serial port name.
Callers must call Close on Emitter to publish a final "done" event to signal the host no more events are coming. If the "done" event is not published, qemu.EventChannel is configured to return an error on VM exit on the host.
T should be the type of a JSON event being sent, matching the host configuration on qemu.EventChannel reading from this channel.
The name should match the qemu.EventChannel configuration on the host as well.
func (*Emitter[T]) Close ¶
Close sends the "done" event to assure the host there will be no more events and closes the event channel.