[PATCH 6/6] Add some tests for bhyveParseCommandLineString

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




---
 tests/Makefile.am                                  |  23 ++-
 .../bhyveargv2xmldata/bhyveargv2xml-acpiapic.args  |   9 +
 tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.xml |  20 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.args |   8 +
 tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.xml  |  21 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-base.args    |   7 +
 tests/bhyveargv2xmldata/bhyveargv2xml-base.xml     |  16 ++
 .../bhyveargv2xml-bhyveload-bootorder.args         |  13 ++
 .../bhyveargv2xml-bhyveload-bootorder.xml          |  27 +++
 .../bhyveargv2xml-bhyveload-custom.args            |  11 ++
 .../bhyveargv2xml-bhyveload-custom.xml             |  18 ++
 .../bhyveargv2xml-bhyveload-mem-mismatch.args      |  12 ++
 .../bhyveargv2xml-bhyveload-memsize-fail.args      |  12 ++
 .../bhyveargv2xml-bhyveload-name-mismatch.args     |  12 ++
 .../bhyveargv2xml-bhyveload-vda.args               |  12 ++
 .../bhyveargv2xml-bhyveload-vda.xml                |  21 ++
 .../bhyveargv2xml-bhyverun-mem-mismatch.args       |  12 ++
 .../bhyveargv2xml-bhyverun-name-mismatch.args      |  12 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.args   |   8 +
 tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.xml    |  21 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-console.args |  10 +
 tests/bhyveargv2xmldata/bhyveargv2xml-console.xml  |  28 +++
 .../bhyveargv2xmldata/bhyveargv2xml-console2.args  |  10 +
 tests/bhyveargv2xmldata/bhyveargv2xml-console2.xml |  15 ++
 .../bhyveargv2xmldata/bhyveargv2xml-console3.args  |  11 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-console3.xml |  27 +++
 .../bhyveargv2xmldata/bhyveargv2xml-console4.args  |  10 +
 tests/bhyveargv2xmldata/bhyveargv2xml-console4.xml |  15 ++
 .../bhyveargv2xml-custom-loader.args               |   8 +
 .../bhyveargv2xml-custom-loader.xml                |  18 ++
 .../bhyveargv2xml-disk-toomany.args                |  34 ++++
 .../bhyveargv2xml-disk-toomany.xml                 | 146 ++++++++++++++
 .../bhyveargv2xmldata/bhyveargv2xml-extraargs.args |   8 +
 .../bhyveargv2xml-memsize-fail.args                |   7 +
 .../bhyveargv2xml-memsize-human.args               |   7 +
 .../bhyveargv2xml-memsize-human.xml                |  16 ++
 .../bhyveargv2xml-memsize-large.args               |   7 +
 .../bhyveargv2xml-memsize-large.xml                |  16 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-name.args    |   7 +
 tests/bhyveargv2xmldata/bhyveargv2xml-name.xml     |  16 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-oneline.args |   1 +
 tests/bhyveargv2xmldata/bhyveargv2xml-oneline.xml  |  16 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-utc.args     |   8 +
 tests/bhyveargv2xmldata/bhyveargv2xml-utc.xml      |  16 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-uuid.args    |   8 +
 tests/bhyveargv2xmldata/bhyveargv2xml-uuid.xml     |  16 ++
 tests/bhyveargv2xmldata/bhyveargv2xml-uuid2.args   |   8 +
 tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.args   |   7 +
 tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.xml    |  16 ++
 .../bhyveargv2xml-virtio-blk.args                  |   8 +
 .../bhyveargv2xmldata/bhyveargv2xml-virtio-blk.xml |  21 ++
 .../bhyveargv2xml-virtio-net.args                  |   9 +
 .../bhyveargv2xmldata/bhyveargv2xml-virtio-net.xml |  26 +++
 .../bhyveargv2xml-virtio-net2.args                 |   8 +
 .../bhyveargv2xml-virtio-net2.xml                  |  16 ++
 .../bhyveargv2xml-virtio-net3.args                 |   8 +
 .../bhyveargv2xml-virtio-net3.xml                  |  16 ++
 .../bhyveargv2xml-virtio-net4.args                 |   8 +
 .../bhyveargv2xml-virtio-net4.xml                  |  21 ++
 tests/bhyveargv2xmlmock.c                          |  27 +++
 tests/bhyveargv2xmltest.c                          | 213 +++++++++++++++++++++
 61 files changed, 1185 insertions(+), 3 deletions(-)
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-base.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-base.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.xml
 create mode 100644
tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-mem-mismatch.args
 create mode 100644
tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-memsize-fail.args
 create mode 100644
tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-name-mismatch.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-mem-mismatch.args
 create mode 100644
tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-name-mismatch.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console2.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console2.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console3.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console3.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console4.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-console4.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-extraargs.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-memsize-fail.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-name.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-name.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-oneline.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-oneline.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-utc.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-utc.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-uuid.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-uuid.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-uuid2.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.xml
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.args
 create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.xml
 create mode 100644 tests/bhyveargv2xmlmock.c
 create mode 100644 tests/bhyveargv2xmltest.c

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 444e0fd..34e46c3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -86,6 +86,7 @@ MOCKLIBS_LIBS = \
 EXTRA_DIST =		\
 	.valgrind.supp \
 	bhyvexml2argvdata \
+	bhyveargv2xmldata \
 	bhyvexml2xmloutdata \
 	capabilityschemadata \
 	commanddata \
@@ -284,7 +285,7 @@ test_programs += vmwarevertest
 endif WITH_VMWARE

 if WITH_BHYVE
-test_programs += bhyvexml2argvtest bhyvexml2xmltest
+test_programs += bhyvexml2argvtest bhyvexml2xmltest bhyveargv2xmltest
 endif WITH_BHYVE

 if WITH_CIL
@@ -415,7 +416,7 @@ test_libraries += libqemumonitortestutils.la \
 endif WITH_QEMU

 if WITH_BHYVE
-test_libraries += bhyvexml2argvmock.la
+test_libraries += bhyvexml2argvmock.la bhyveargv2xmlmock.la
 endif WITH_BHYVE

 if WITH_DBUS
@@ -741,6 +742,12 @@ bhyvexml2argvmock_la_CFLAGS = $(AM_CFLAGS)
 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
@@ -755,8 +762,18 @@ bhyvexml2xmltest_SOURCES = \
 	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 = \
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.args
new file mode 100644
index 0000000..cf3ec61
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.args
@@ -0,0 +1,9 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-A \
+-I \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.xml
new file mode 100644
index 0000000..d6c940f
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-acpiapic.xml
@@ -0,0 +1,20 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.args
new file mode 100644
index 0000000..9924203
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,ahci-hd,/tmp/freebsd.img \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.xml
new file mode 100644
index 0000000..fcf0fee
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-ahci-hd.xml
@@ -0,0 +1,21 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-base.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-base.args
new file mode 100644
index 0000000..1334030
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-base.args
@@ -0,0 +1,7 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-base.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-base.xml
new file mode 100644
index 0000000..68d9f10
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-base.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.args
new file mode 100644
index 0000000..aefa827
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.args
@@ -0,0 +1,13 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.xml
new file mode 100644
index 0000000..3d7a67e
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-bootorder.xml
@@ -0,0 +1,27 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.args
new file mode 100644
index 0000000..0185b83
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.args
@@ -0,0 +1,11 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-S \
+bhyve
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.xml
new file mode 100644
index 0000000..077c089
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-custom.xml
@@ -0,0 +1,18 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-mem-mismatch.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-mem-mismatch.args
new file mode 100644
index 0000000..a87ccd7
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-mem-mismatch.args
@@ -0,0 +1,12 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-memsize-fail.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-memsize-fail.args
new file mode 100644
index 0000000..11b1799
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-memsize-fail.args
@@ -0,0 +1,12 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-name-mismatch.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-name-mismatch.args
new file mode 100644
index 0000000..dbd9a22
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-name-mismatch.args
@@ -0,0 +1,12 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.args
new file mode 100644
index 0000000..7535f86
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.args
@@ -0,0 +1,12 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.xml
new file mode 100644
index 0000000..adbf7f1
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyveload-vda.xml
@@ -0,0 +1,21 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-mem-mismatch.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-mem-mismatch.args
new file mode 100644
index 0000000..d666b02
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-mem-mismatch.args
@@ -0,0 +1,12 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-name-mismatch.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-name-mismatch.args
new file mode 100644
index 0000000..52e8b7b
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-bhyverun-name-mismatch.args
@@ -0,0 +1,12 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.args
new file mode 100644
index 0000000..0c3178e
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,ahci-cd,/tmp/freebsd.iso \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.xml
new file mode 100644
index 0000000..b42b79b
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-cdrom.xml
@@ -0,0 +1,21 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-console.args
new file mode 100644
index 0000000..40617a6
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console.args
@@ -0,0 +1,10 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-console.xml
new file mode 100644
index 0000000..916db9f
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console.xml
@@ -0,0 +1,28 @@
+<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>
+    <console type='nmdm'>
+      <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>
+      <target type='serial' port='0'/>
+    </console>
+  </devices>
+</domain>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console2.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-console2.args
new file mode 100644
index 0000000..fd86c40
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console2.args
@@ -0,0 +1,10 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console2.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-console2.xml
new file mode 100644
index 0000000..12467e9
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console2.xml
@@ -0,0 +1,15 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console3.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-console3.args
new file mode 100644
index 0000000..2e428c4
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console3.args
@@ -0,0 +1,11 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console3.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-console3.xml
new file mode 100644
index 0000000..2aea6c4
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console3.xml
@@ -0,0 +1,27 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console4.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-console4.args
new file mode 100644
index 0000000..f02ef71
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console4.args
@@ -0,0 +1,10 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-console4.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-console4.xml
new file mode 100644
index 0000000..12467e9
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-console4.xml
@@ -0,0 +1,15 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.args
new file mode 100644
index 0000000..ed6398b
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.args
@@ -0,0 +1,8 @@
+/usr/bin/custom-loader with several arguments
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.xml
new file mode 100644
index 0000000..3e9bd29
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-custom-loader.xml
@@ -0,0 +1,18 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.args
new file mode 100644
index 0000000..5cdefb6
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.args
@@ -0,0 +1,34 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.xml
new file mode 100644
index 0000000..6e0c06c
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-disk-toomany.xml
@@ -0,0 +1,146 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-extraargs.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-extraargs.args
new file mode 100644
index 0000000..1c3d7c6
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-extraargs.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve \
+bogus
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-fail.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-fail.args
new file mode 100644
index 0000000..9e5c02c
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-fail.args
@@ -0,0 +1,7 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m bogus \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.args
new file mode 100644
index 0000000..f31343e
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.args
@@ -0,0 +1,7 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214M \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.xml
new file mode 100644
index 0000000..68d9f10
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-human.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.args
new file mode 100644
index 0000000..ffdc4f0
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.args
@@ -0,0 +1,7 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 224395264 \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.xml
new file mode 100644
index 0000000..68d9f10
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-memsize-large.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-name.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-name.args
new file mode 100644
index 0000000..f08d93a
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-name.args
@@ -0,0 +1,7 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+name
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-name.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-name.xml
new file mode 100644
index 0000000..e241f2b
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-name.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-oneline.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-oneline.args
new file mode 100644
index 0000000..d7e5434
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-oneline.args
@@ -0,0 +1 @@
+/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge   bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-oneline.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-oneline.xml
new file mode 100644
index 0000000..68d9f10
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-oneline.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-utc.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-utc.args
new file mode 100644
index 0000000..0f8b963
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-utc.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-utc.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-utc.xml
new file mode 100644
index 0000000..8e4e1a3
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-utc.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-uuid.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-uuid.args
new file mode 100644
index 0000000..841ec3e
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-uuid.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-U 2a793ea6-8e52-440a-8458-355e98492e17 \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-uuid.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-uuid.xml
new file mode 100644
index 0000000..2a1dd9f
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-uuid.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-uuid2.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-uuid2.args
new file mode 100644
index 0000000..5925404
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-uuid2.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-U garbage \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.args
new file mode 100644
index 0000000..1fb2bc6
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.args
@@ -0,0 +1,7 @@
+/usr/sbin/bhyve \
+-c 4 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.xml
new file mode 100644
index 0000000..1b83940
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-vcpus.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.args
new file mode 100644
index 0000000..c6c6f77
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 2:0,virtio-blk,/tmp/freebsd.img \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.xml
new file mode 100644
index 0000000..adbf7f1
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-blk.xml
@@ -0,0 +1,21 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.args
new file mode 100644
index 0000000..db7929e
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.args
@@ -0,0 +1,9 @@
+/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
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.xml
new file mode 100644
index 0000000..09cc79b
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.xml
@@ -0,0 +1,26 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.args
new file mode 100644
index 0000000..f4488c8
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:0,virtio-net,notatap \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.xml
new file mode 100644
index 0000000..68d9f10
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net2.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.args
new file mode 100644
index 0000000..e873587
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:1,virtio-net,tap1,notamac \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.xml
new file mode 100644
index 0000000..68d9f10
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net3.xml
@@ -0,0 +1,16 @@
+<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>
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.args
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.args
new file mode 100644
index 0000000..0b7921b
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.args
@@ -0,0 +1,8 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:1,virtio-net,tap1,mac=garbage \
+bhyve
diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.xml
b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.xml
new file mode 100644
index 0000000..e1bda46
--- /dev/null
+++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.xml
@@ -0,0 +1,21 @@
+<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>
diff --git a/tests/bhyveargv2xmlmock.c b/tests/bhyveargv2xmlmock.c
new file mode 100644
index 0000000..1f08beb
--- /dev/null
+++ b/tests/bhyveargv2xmlmock.c
@@ -0,0 +1,27 @@
+#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;
+}
diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c
new file mode 100644
index 0000000..bbcd0a6
--- /dev/null
+++ b/tests/bhyveargv2xmltest.c
@@ -0,0 +1,213 @@
+#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 */
-- 
2.5.5


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]