EXTRA_DIST = \
.valgrind.supp \
bhyvexml2argvdata \
+ bhyveargv2xmldata \
bhyvexml2xmloutdata \
capabilityschemadata \
commanddata \
endif WITH_VMWARE
if WITH_BHYVE
-test_programs += bhyvexml2argvtest bhyvexml2xmltest
+test_programs += bhyvexml2argvtest bhyvexml2xmltest bhyveargv2xmltest
endif WITH_BHYVE
if WITH_CIL
endif WITH_QEMU
if WITH_BHYVE
-test_libraries += bhyvexml2argvmock.la
+test_libraries += bhyvexml2argvmock.la bhyveargv2xmlmock.la
endif WITH_BHYVE
if WITH_DBUS
bhyvexml2argvmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
bhyvexml2argvmock_la_LIBADD = $(MOCKLIBS_LIBS)
+bhyveargv2xmlmock_la_SOURCES = \
+ bhyveargv2xmlmock.c
+bhyveargv2xmlmock_la_CFLAGS = $(AM_CFLAGS)
+bhyveargv2xmlmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+bhyveargv2xmlmock_la_LIBADD = $(MOCKLIBS_LIBS)
+
bhyve_LDADDS = ../src/libvirt_driver_bhyve_impl.la
if WITH_STORAGE
bhyve_LDADDS += ../src/libvirt_driver_storage_impl.la
bhyvexml2xmltest.c \
testutils.c testutils.h
bhyvexml2xmltest_LDADD = $(bhyve_LDADDS)
+
+bhyveargv2xmltest_SOURCES = \
+ bhyveargv2xmltest.c \
+ testutils.c testutils.h
+bhyveargv2xmltest_LDADD = $(bhyve_LDADDS)
else ! WITH_BHYVE
-EXTRA_DIST += bhyvexml2argvtest.c bhyvexml2xmltest.c bhyvexml2argvmock.c
+EXTRA_DIST += \
+ bhyvexml2argvtest.c \
+ bhyveargv2xmltest.c \
+ bhyvexml2xmltest.c \
+ bhyvexml2argvmock.c \
+ bhyveargv2xmlmock.c
endif ! WITH_BHYVE
networkxml2xmltest_SOURCES = \
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-A \
+-I \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ </features>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,ahci-hd,/tmp/freebsd.img bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='sda' bus='sata'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </disk>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/disk2.img bhyve
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/disk1.img \
+-s 3:0,virtio-blk,/tmp/disk2.img bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/tmp/disk1.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/disk2.img'/>
+ <target dev='vdb' bus='virtio'/>
+ <boot order='1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyveload \
+-m 214 \
+-S bhyve
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <bootloader>/usr/sbin/bhyveload</bootloader>
+ <bootloader_args>-m 214 -S bhyve</bootloader_args>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyveload \
+-m 412 \
+-d /tmp/freebsd.img bhyve
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img bhyve
--- /dev/null
+/usr/sbin/bhyveload \
+-m bogus \
+-d /tmp/freebsd.img bhyve
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img bhyve
--- /dev/null
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img othervm
--- /dev/null
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </disk>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 412 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img bhyve
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img bhyve
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img othervm
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,ahci-cd,/tmp/freebsd.iso bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='cdrom'>
+ <source file='/tmp/freebsd.iso'/>
+ <target dev='sda' bus='sata'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </disk>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1,lpc \
+-l com1,/dev/nmdm0A \
+-l com2,/dev/nmdm1B bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <serial type='nmdm'>
+ <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>
+ <target port='0'/>
+ </serial>
+ <serial type='nmdm'>
+ <source master='/dev/nmdm1B' slave='/dev/nmdm1A'/>
+ <target port='1'/>
+ </serial>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1,lpc \
+-l com1,/dev/nmdm0C \
+-l com2,/dev/nmdm1D bhyve
--- /dev/null
+<domain type='bhyve'>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1,lpc \
+-l com1,/dev/nmdm0A \
+-l com2,/dev/nmdm1B \
+-l com3,/dev/nmdm2B bhyve
--- /dev/null
+<domain type='bhyve'>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <serial type='nmdm'>
+ <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>
+ <target port='0'/>
+ </serial>
+ <serial type='nmdm'>
+ <source master='/dev/nmdm1B' slave='/dev/nmdm1A'/>
+ <target port='1'/>
+ </serial>
+ <console type='nmdm'>
+ <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>
+ <target type='serial' port='0'/>
+ </console>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1,lpc \
+-l com1,/dev/whatever0A \
+-l com2,/dev/whatever1B bhyve
--- /dev/null
+<domain type='bhyve'>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/bin/custom-loader \
+-s ome \
+--args
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <bootloader>/usr/bin/custom-loader</bootloader>
+ <bootloader_args>with several arguments</bootloader_args>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:0,virtio-blk,/tmp/freebsd.img \
+-s 2:0,virtio-blk,/tmp/freebsd.img \
+-s 3:0,virtio-blk,/tmp/freebsd.img \
+-s 4:0,virtio-blk,/tmp/freebsd.img \
+-s 5:0,virtio-blk,/tmp/freebsd.img \
+-s 6:0,virtio-blk,/tmp/freebsd.img \
+-s 7:0,virtio-blk,/tmp/freebsd.img \
+-s 8:0,virtio-blk,/tmp/freebsd.img \
+-s 9:0,virtio-blk,/tmp/freebsd.img \
+-s 10:0,virtio-blk,/tmp/freebsd.img \
+-s 11:0,virtio-blk,/tmp/freebsd.img \
+-s 12:0,virtio-blk,/tmp/freebsd.img \
+-s 13:0,virtio-blk,/tmp/freebsd.img \
+-s 14:0,virtio-blk,/tmp/freebsd.img \
+-s 15:0,virtio-blk,/tmp/freebsd.img \
+-s 16:0,virtio-blk,/tmp/freebsd.img \
+-s 17:0,virtio-blk,/tmp/freebsd.img \
+-s 18:0,virtio-blk,/tmp/freebsd.img \
+-s 19:0,virtio-blk,/tmp/freebsd.img \
+-s 20:0,virtio-blk,/tmp/freebsd.img \
+-s 21:0,virtio-blk,/tmp/freebsd.img \
+-s 22:0,virtio-blk,/tmp/freebsd.img \
+-s 23:0,virtio-blk,/tmp/freebsd.img \
+-s 24:0,virtio-blk,/tmp/freebsd.img \
+-s 25:0,virtio-blk,/tmp/freebsd.img \
+-s 26:0,virtio-blk,/tmp/freebsd.img \
+-s 27:0,virtio-blk,/tmp/freebsd.img bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdc' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdd' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vde' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdf' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdg' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdh' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdi' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdj' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdk' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdl' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdm' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdn' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdo' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdp' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdq' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdr' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vds' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x13' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdt' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdu' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x15' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdv' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x16' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdw' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x17' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdx' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x18' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdy' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vdz' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x0'/>
+ </disk>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge bhyve bogus
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m bogus \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214M \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 224395264 \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge name
--- /dev/null
+<domain type='bhyve'>
+ <name>name</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-U 2a793ea6-8e52-440a-8458-355e98492e17 \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>2a793ea6-8e52-440a-8458-355e98492e17</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-U garbage \
+-s 0:0,hostbridge bhyve
--- /dev/null
+/usr/sbin/bhyve \
+-c 4 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </disk>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:0,virtio-net,tap0 \
+-s 1:1,virtio-net,tap1,mac=FE:ED:AD:EA:DF:15 bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <interface type='ethernet'>
+ <mac address='52:54:00:00:00:00'/>
+ <target dev='tap0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </interface>
+ <interface type='ethernet'>
+ <mac address='fe:ed:ad:ea:df:15'/>
+ <target dev='tap1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </interface>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:0,virtio-net,notatap bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:1,virtio-net,tap1,notamac bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ </devices>
+</domain>
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:1,virtio-net,tap1,mac=garbage bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <interface type='ethernet'>
+ <mac address='00:00:00:00:00:00'/>
+ <target dev='tap1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </interface>
+ </devices>
+</domain>
--- /dev/null
+#include <config.h>
+
+#include "virnetdev.h"
+#include "internal.h"
+#include "util/viruuid.h"
+
+#define VIR_FROM_THIS VIR_FROM_BHYVE
+
+void
+virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN],
+ virMacAddrPtr addr)
+{
+ addr->addr[0] = prefix[0];
+ addr->addr[1] = prefix[1];
+ addr->addr[2] = prefix[2];
+ addr->addr[3] = 0;
+ addr->addr[4] = 0;
+ addr->addr[5] = 0;
+}
+
+int
+virUUIDGenerate(unsigned char *uuid)
+{
+ if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", uuid) < 0)
+ return -1;
+ return 0;
+}
--- /dev/null
+#include <config.h>
+
+#include "testutils.h"
+
+#ifdef WITH_BHYVE
+
+# include "datatypes.h"
+
+# include "util/viruuid.h"
+# include "bhyve/bhyve_driver.h"
+# include "bhyve/bhyve_capabilities.h"
+# include "bhyve/bhyve_utils.h"
+# include "bhyve/bhyve_parse_command.h"
+
+# define VIR_FROM_THIS VIR_FROM_BHYVE
+
+static bhyveConn driver;
+
+typedef enum {
+ FLAG_EXPECT_FAILURE = 1,
+ FLAG_EXPECT_PARSE_ERROR = 2,
+ FLAG_EXPECT_WARNING = 4,
+} virBhyveArgv2XMLTestFlags;
+
+static int
+testCompareXMLToArgvFiles(const char *xmlfile,
+ const char *cmdfile,
+ unsigned int flags)
+
+{
+ char *actualxml = NULL;
+ char *cmd = NULL;
+ char *log = NULL;
+ int ret = -1;
+ virDomainDefPtr vmdef = NULL;
+
+ if (virTestLoadFile(cmdfile, &cmd) < 0)
+ goto fail;
+
+ if (!(vmdef = bhyveParseCommandLineString(cmd, driver.bhyvecaps,
+ driver.xmlopt))) {
+ if ((flags & FLAG_EXPECT_FAILURE) && !virTestOOMActive()) {
+ VIR_TEST_DEBUG("Got expected failure from "
+ "bhyveParseCommandLineString.\n");
+ } else {
+ goto fail;
+ }
+ } else if ((flags & FLAG_EXPECT_FAILURE) && !virTestOOMActive()) {
+ VIR_TEST_DEBUG("Did not get expected failure from "
+ "bhyveParseCommandLineString.\n");
+ goto fail;
+ }
+
+ if (!virTestOOMActive()) {
+ if ((log = virTestLogContentAndReset()) == NULL)
+ goto fail;
+ if (flags & FLAG_EXPECT_WARNING) {
+ if (*log) {
+ VIR_TEST_DEBUG("Got expected warning from "
+ "bhyveParseCommandLineString:\n%s",
+ log);
+ } else {
+ VIR_TEST_DEBUG("bhyveParseCommandLineString "
+ "should have logged a warning\n");
+ goto fail;
+ }
+ } else { /* didn't expect a warning */
+ if (*log) {
+ VIR_TEST_DEBUG("Got unexpected warning from "
+ "bhyveParseCommandLineString:\n%s",
+ log);
+ goto fail;
+ }
+ }
+ }
+
+ if (vmdef && !virDomainDefCheckABIStability(vmdef, vmdef)) {
+ VIR_TEST_DEBUG("ABI stability check failed on %s", xmlfile);
+ goto fail;
+ }
+
+ if (vmdef && !(actualxml = virDomainDefFormat(vmdef, driver.caps, 0)))
+ goto fail;
+
+ if (vmdef && virTestCompareToFile(actualxml, xmlfile) < 0)
+ goto fail;
+
+ ret = 0;
+
+ fail:
+ VIR_FREE(actualxml);
+ VIR_FREE(cmd);
+ VIR_FREE(log);
+ virDomainDefFree(vmdef);
+ return ret;
+}
+
+struct testInfo {
+ const char *name;
+ unsigned int flags;
+};
+
+static int
+testCompareXMLToArgvHelper(const void *data)
+{
+ int result = -1;
+ const struct testInfo *info = data;
+ char *xml = NULL;
+ char *args = NULL;
+
+ if (virAsprintf(&xml, "%s/bhyveargv2xmldata/bhyveargv2xml-%s.xml",
+ abs_srcdir, info->name) < 0 ||
+ virAsprintf(&args, "%s/bhyveargv2xmldata/bhyveargv2xml-%s.args",
+ abs_srcdir, info->name) < 0)
+ goto cleanup;
+
+ result = testCompareXMLToArgvFiles(xml, args, info->flags);
+
+ cleanup:
+ VIR_FREE(xml);
+ VIR_FREE(args);
+ return result;
+}
+
+static int
+mymain(void)
+{
+ int ret = 0;
+
+ if ((driver.caps = virBhyveCapsBuild()) == NULL)
+ return EXIT_FAILURE;
+
+ if ((driver.xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)) == NULL)
+ return EXIT_FAILURE;
+
+# define DO_TEST_FULL(name, flags) \
+ do { \
+ static struct testInfo info = { \
+ name, (flags) \
+ }; \
+ if (virTestRun("BHYVE ARGV-2-XML " name, \
+ testCompareXMLToArgvHelper, &info) < 0) \
+ ret = -1; \
+ } while (0)
+
+# define DO_TEST(name) \
+ DO_TEST_FULL(name, 0)
+
+# define DO_TEST_FAIL(name) \
+ DO_TEST_FULL(name, 5)
+
+# define DO_TEST_WARN(name) \
+ DO_TEST_FULL(name, 4)
+
+# define DO_TEST_FAIL_SILENT(name) \
+ DO_TEST_FULL(name, 1)
+
+# define DO_TEST_PARSE_ERROR(name) \
+ DO_TEST_FULL(name, 2)
+
+ driver.grubcaps = BHYVE_GRUB_CAP_CONSDEV;
+ driver.bhyvecaps = BHYVE_CAP_RTC_UTC;
+
+ DO_TEST("base");
+ DO_TEST("oneline");
+ DO_TEST("name");
+ DO_TEST("console");
+ DO_TEST_FAIL("console2");
+ DO_TEST_FAIL("console3");
+ DO_TEST_FAIL("console4");
+ DO_TEST("acpiapic");
+ DO_TEST("utc");
+ DO_TEST("vcpus");
+ DO_TEST("cdrom");
+ DO_TEST("ahci-hd");
+ DO_TEST("virtio-blk");
+ DO_TEST("virtio-net");
+ DO_TEST_WARN("virtio-net2");
+ DO_TEST_WARN("virtio-net3");
+ DO_TEST_WARN("virtio-net4");
+ DO_TEST_WARN("disk-toomany");
+ DO_TEST("uuid");
+ DO_TEST_FAIL("uuid2");
+ DO_TEST("memsize-large");
+ DO_TEST("memsize-human");
+ DO_TEST_FAIL("memsize-fail");
+ DO_TEST("custom-loader");
+ DO_TEST("bhyveload-custom");
+ DO_TEST("bhyveload-vda");
+ DO_TEST_FAIL("bhyveload-name-mismatch");
+ DO_TEST_FAIL("bhyverun-name-mismatch");
+ DO_TEST_FAIL("bhyveload-mem-mismatch");
+ DO_TEST_FAIL("bhyverun-mem-mismatch");
+ DO_TEST_FAIL("bhyveload-mem-mismatch");
+ DO_TEST_FAIL("bhyveload-memsize-fail");
+ DO_TEST("bhyveload-bootorder");
+ DO_TEST_FAIL("extraargs");
+
+ virObjectUnref(driver.caps);
+ virObjectUnref(driver.xmlopt);
+
+ return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/bhyveargv2xmlmock.so")
+
+#else
+
+int main(void)
+{
+ return EXIT_AM_SKIP;
+}
+
+#endif /* WITH_BHYVE */