aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/domainschematest2
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.args1
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml22
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.args1
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml28
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.args1
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml28
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.args1
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml31
-rw-r--r--tests/qemuxml2argvtest.c7
-rw-r--r--tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml25
-rw-r--r--tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml54
-rw-r--r--tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml31
-rw-r--r--tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml31
-rw-r--r--tests/qemuxml2xmltest.c79
16 files changed, 324 insertions, 19 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a3661f61c..71c2c74e2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -43,6 +43,7 @@ EXTRA_DIST = \
oomtrace.pl \
test-lib.sh \
qemuxml2argvdata \
+ qemuxml2xmloutdata \
nodeinfodata \
schematestutils.sh \
capabilityschematest \
diff --git a/tests/domainschematest b/tests/domainschematest
index d513f5adf..7557cef5d 100755
--- a/tests/domainschematest
+++ b/tests/domainschematest
@@ -4,7 +4,7 @@
. $srcdir/test-lib.sh
. $abs_srcdir/schematestutils.sh
-DIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata"
+DIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata qemuxml2xmloutdata"
SCHEMA="domain.rng"
check_schema "$DIRS" "$SCHEMA"
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.args
new file mode 100644
index 000000000..08f0b8a7a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml
new file mode 100644
index 000000000..26c9b2594
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.args b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.args
new file mode 100644
index 000000000..fd42462f9
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial pty -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml
new file mode 100644
index 000000000..f0e875e3a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <console type='pty'>
+ <target port='0'/>
+ </console>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.args
new file mode 100644
index 000000000..e29a4e813
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device lsi,id=scsi0,bus=pci.0,addr=0x2 -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/tmp/scsidisk.img,if=none,id=drive-scsi0-0-0 -device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml
new file mode 100644
index 000000000..df50a27d7
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <disk type='file' device='disk'>
+ <source file='/tmp/scsidisk.img'/>
+ <target dev='sda' bus='scsi'/>
+ </disk>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.args
new file mode 100644
index 000000000..e29a4e813
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device lsi,id=scsi0,bus=pci.0,addr=0x2 -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/tmp/scsidisk.img,if=none,id=drive-scsi0-0-0 -device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml
new file mode 100644
index 000000000..a250940fa
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml
@@ -0,0 +1,31 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/scsidisk.img'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <controller type='scsi' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0ca98042c..a967fef2b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -275,6 +275,10 @@ mymain(int argc, char **argv)
DO_TEST("disk-usb", 0);
DO_TEST("disk-usb-device", QEMUD_CMD_FLAG_DRIVE |
QEMUD_CMD_FLAG_DEVICE | QEMUD_CMD_FLAG_NODEFCONFIG);
+ DO_TEST("disk-scsi-device", QEMUD_CMD_FLAG_DRIVE |
+ QEMUD_CMD_FLAG_DEVICE | QEMUD_CMD_FLAG_NODEFCONFIG);
+ DO_TEST("disk-scsi-device-auto", QEMUD_CMD_FLAG_DRIVE |
+ QEMUD_CMD_FLAG_DEVICE | QEMUD_CMD_FLAG_NODEFCONFIG);
DO_TEST("graphics-vnc", 0);
driver.vncSASL = 1;
@@ -320,6 +324,7 @@ mymain(int argc, char **argv)
DO_TEST("serial-many", 0);
DO_TEST("parallel-tcp", 0);
DO_TEST("console-compat", 0);
+ DO_TEST("console-compat-auto", 0);
DO_TEST("serial-vc-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE |
QEMUD_CMD_FLAG_NODEFCONFIG);
@@ -356,6 +361,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_NODEFCONFIG);
DO_TEST("balloon-device", QEMUD_CMD_FLAG_DEVICE |
QEMUD_CMD_FLAG_NODEFCONFIG);
+ DO_TEST("balloon-device-auto", QEMUD_CMD_FLAG_DEVICE |
+ QEMUD_CMD_FLAG_NODEFCONFIG);
DO_TEST("sound", 0);
DO_TEST("sound-device", QEMUD_CMD_FLAG_DEVICE |
QEMUD_CMD_FLAG_NODEFCONFIG);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
new file mode 100644
index 000000000..ed91e37a1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
new file mode 100644
index 000000000..79903748c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
@@ -0,0 +1,54 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu cpuset='1-4,8-20,525'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <controller type='virtio-serial' index='0' ports='16' vectors='4'/>
+ <controller type='virtio-serial' index='1'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+ </controller>
+ <controller type='virtio-serial' index='2'/>
+ <channel type='pty'>
+ <target type='virtio' name='org.linux-kvm.port.0'/>
+ <address type='virtio-serial' controller='0' bus='0' port='0'/>
+ </channel>
+ <channel type='pty'>
+ <target type='virtio' name='org.linux-kvm.port.foo'/>
+ <address type='virtio-serial' controller='1' bus='0' port='0'/>
+ </channel>
+ <channel type='pty'>
+ <target type='virtio' name='org.linux-kvm.port.bar'/>
+ <address type='virtio-serial' controller='1' bus='0' port='3'/>
+ </channel>
+ <channel type='pty'>
+ <target type='virtio' name='org.linux-kvm.port.wizz'/>
+ <address type='virtio-serial' controller='0' bus='0' port='1'/>
+ </channel>
+ <channel type='pty'>
+ <target type='virtio' name='org.linux-kvm.port.ooh'/>
+ <address type='virtio-serial' controller='1' bus='0' port='4'/>
+ </channel>
+ <channel type='pty'>
+ <target type='virtio' name='org.linux-kvm.port.lla'/>
+ <address type='virtio-serial' controller='2' bus='0' port='0'/>
+ </channel>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
new file mode 100644
index 000000000..611ddb8d7
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
@@ -0,0 +1,31 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <serial type='pty'>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <target port='0'/>
+ </console>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
new file mode 100644
index 000000000..a250940fa
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
@@ -0,0 +1,31 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='/tmp/scsidisk.img'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <controller type='scsi' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 00b3a1b18..0f4c83cb8 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -22,41 +22,63 @@ static struct qemud_driver driver;
# define MAX_FILE 4096
-static int testCompareXMLToXMLFiles(const char *xml) {
- char xmlData[MAX_FILE];
- char *xmlPtr = &(xmlData[0]);
+static int testCompareXMLToXMLFiles(const char *inxml, const char *outxml) {
+ char inXmlData[MAX_FILE];
+ char *inXmlPtr = &(inXmlData[0]);
+ char outXmlData[MAX_FILE];
+ char *outXmlPtr = &(outXmlData[0]);
char *actual = NULL;
int ret = -1;
- virDomainDefPtr vmdef = NULL;
+ virDomainDefPtr def = NULL;
- if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
+ if (virtTestLoadFile(inxml, &inXmlPtr, MAX_FILE) < 0)
+ goto fail;
+ if (virtTestLoadFile(outxml, &outXmlPtr, MAX_FILE) < 0)
goto fail;
- if (!(vmdef = virDomainDefParseString(driver.caps, xmlData,
+ if (!(def = virDomainDefParseString(driver.caps, inXmlData,
VIR_DOMAIN_XML_INACTIVE)))
goto fail;
- if (!(actual = virDomainDefFormat(vmdef, 0)))
+ if (!(actual = virDomainDefFormat(def, 0)))
goto fail;
- if (STRNEQ(xmlData, actual)) {
- virtTestDifference(stderr, xmlData, actual);
+
+ if (STRNEQ(outXmlData, actual)) {
+ virtTestDifference(stderr, outXmlData, actual);
goto fail;
}
ret = 0;
-
fail:
free(actual);
- virDomainDefFree(vmdef);
+ virDomainDefFree(def);
return ret;
}
+struct testInfo {
+ const char *name;
+ int different;
+};
+
static int testCompareXMLToXMLHelper(const void *data) {
- char xml[PATH_MAX];
- snprintf(xml, PATH_MAX, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
- abs_srcdir, (const char*)data);
- return testCompareXMLToXMLFiles(xml);
+ const struct testInfo *info = data;
+ char xml_in[PATH_MAX];
+ char xml_out[PATH_MAX];
+ int ret;
+
+ snprintf(xml_in, PATH_MAX, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
+ abs_srcdir, info->name);
+ snprintf(xml_out, PATH_MAX, "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
+ abs_srcdir, info->name);
+
+ if (info->different) {
+ ret = testCompareXMLToXMLFiles(xml_in, xml_out);
+ } else {
+ ret = testCompareXMLToXMLFiles(xml_in, xml_in);
+ }
+
+ return ret;
}
@@ -80,10 +102,24 @@ mymain(int argc, char **argv)
if ((driver.caps = testQemuCapsInit()) == NULL)
return (EXIT_FAILURE);
+# define DO_TEST_FULL(name, is_different) \
+ do { \
+ const struct testInfo info = {name, is_different}; \
+ if (virtTestRun("QEMU XML-2-XML " name, \
+ 1, testCompareXMLToXMLHelper, &info) < 0) \
+ ret = -1; \
+ } while (0)
+
# define DO_TEST(name) \
- if (virtTestRun("QEMU XML-2-XML " name, \
- 1, testCompareXMLToXMLHelper, (name)) < 0) \
- ret = -1
+ DO_TEST_FULL(name, 0)
+
+# define DO_TEST_DIFFERENT(name) \
+ DO_TEST_FULL(name, 1)
+
+ /* Unset or set all envvars here that are copied in qemudBuildCommandLine
+ * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
+ * values for these envvars */
+ setenv("PATH", "/bin", 1);
DO_TEST("minimal");
DO_TEST("boot-cdrom");
@@ -107,6 +143,7 @@ mymain(int argc, char **argv)
DO_TEST("disk-drive-cache-v1-wt");
DO_TEST("disk-drive-cache-v1-wb");
DO_TEST("disk-drive-cache-v1-none");
+ DO_TEST("disk-scsi-device");
DO_TEST("graphics-vnc");
DO_TEST("graphics-vnc-sasl");
DO_TEST("graphics-vnc-tls");
@@ -142,6 +179,12 @@ mymain(int argc, char **argv)
DO_TEST("encrypted-disk");
+ /* These tests generate different XML */
+ DO_TEST_DIFFERENT("balloon-device-auto");
+ DO_TEST_DIFFERENT("channel-virtio-auto");
+ DO_TEST_DIFFERENT("console-compat-auto");
+ DO_TEST_DIFFERENT("disk-scsi-device-auto");
+
virCapabilitiesFree(driver.caps);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);