The following sections are supported:
Each target is specified using a [[target]]
section. In TOML, this is known
as an array of tables.
The following fields are supported:
-
name
(string)- Required field
- The name of the target. The name is used for documentation and identification purposes.
-
image
(string)- Optional field, but one of
image
andkernel
must be specified - The path to the virtual machine disk image
- If a relative path is provided, it will be interpreted as relative to
vmtest.toml
- Format is auto-detected by QEMU.
- Optional field, but one of
-
uefi
(boolean)- Default:
false
- Whether to use UEFI boot or not
false
implies BIOS boot
- Default:
-
kernel
(string)- Optional field, but one of
image
andkernel
must be specified - The path to the kernel to use
- Typically named
vmlinuz
orbzImage
- If a relative path is provided, it will be interpreted as relative to
vmtest.toml
- See the notes in the README for kernel features that are required.
- Optional field, but one of
-
kernel_args
(string)- Optional field
kernel
must be specified- Additional kernel command line arguments to append to
vmtest
generated kernel arguments
-
rootfs
(string)- Directory, default:
/
kernel
must be specified- Path to rootfs to test against. Will be mounted in the guest using a filesystem protocol that's convenient for virtualisation, such as 9p.
- If a relative path is provided, it will be interpreted as relative to
vmtest.toml
- UIDs from the host will be passed through directly; if you built your
rootfs without privileges in the host, try running
vmtest
viaunshare -r
, so that QEMU (and hence the guest) sees UID 0. - For tips on creating a rootfs (if you don't want to just use your host system's one), see rootfs.md.
- Directory, default:
-
arch
(string)- Default: the architecture vmtest was built for.
- Under which machine architecture to run the kernel.
-
command
(string)- Required field
- Command to run inside VM
- Note that the specified command is run inside a
bash
shell by default vmtest
's environment variables are also propagated into the VM during command execution
-
vm
(VMConfig)- Optional sub-table
- Configures the VM.
- See the VMConfig struct below.
The VMConfig struct that configures the QEMU VM.
num_cpus
(int)- Optional field
- Number of CPUs in the VM.
- Default: 2
memory
(string)- Optional field
- Amount of RAM for the VM.
- Accepts a QEMU parsable string for the -m flag like 256M or 4G.
- Default: 4G
mounts
(Map<String, Mount>)- Optional sub-table
- Map of additional host mounts for the VM.
- Key is the path in the VM and the value contains information about the host path.
- See below for definition of the Mount object.
bios
(string)- Optional field
- Path to the BIOS file.
- This is only used if the UEFI flag from target is true.
extra_args
(List)- Optional field
- Extra arguments to pass to QEMU.
The Mount struct for defining additional host mounts into the VM.
host_path
(string)- Required field
- Path on the host.
- If a relative path is provided, it will be interpreted as relative to
vmtest.toml
writable
(bool)- Optional field
- Whether this mount is writable in the VM.
- Default: false
Mount host tmpfs inside guest with read/write permissions:
[[target]]
name = "test"
kernel = "/home/dlxu/scratch/bzImage-v6.6-default"
command = "ls -l /tmp/hosttmp"
[target.vm.mounts]
"/tmp/hosttmp" = { host_path = "/tmp", writable = true }