mbload loads a Multiboot kernel into a bhyve virtual machine, the way bhyveload(8) loads a FreeBSD kernel, and bhyve(8) without a boot ROM then runs it. The tests of kvm-unit-tests are such kernels, so that they run in bhyve as they are.
vmx-tests.sh runs the tests for VMX, each in a virtual machine of its own, to test nested virtualization (hw.vmm.vmx.nested, D61708). kvm-unit-tests itself is not included, because of its license (GPL-2.0): the README says how to get x86/vmx.flat and which tests are known not to pass.
Why a loader: kvm-unit-tests does not build its VMX tests for UEFI, only as Multiboot images, which QEMU loads with -kernel. Loading them through GRUB under bhyve's UEFI firmware does not work, because the tests take the size of the memory from the first block of the firmware's memory map, which is a few megabytes.
This is the test that Michael Dexter asked for on freebsd-virtualization. I do not know whether tools/test is the right place for it, or whether mbload would be better off next to bhyveload; I am happy to move it.
AI assistance: like D61708, this was developed with an AI assistant (Anthropic's Claude) under my direction.
Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Sponsored by: keelos.dev