unsigned int flags;
unsigned int parseFlags;
bool skipLegacyCPUs;
+ virDomainObjPtr vm;
};
static int
-testCompareXMLToArgv(const void *data)
+testCompareXMLToStartupXML(const void *data)
{
const struct testInfo *info = data;
+ unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
+ char *xml = NULL;
+ char *actual = NULL;
+ int ret = -1;
+
+ if (virAsprintf(&xml, "%s/qemuxml2startupxmloutdata/%s.xml",
+ abs_srcdir, info->name) < 0)
+ goto cleanup;
+
+ if (!virFileExists(xml)) {
+ ret = EXIT_AM_SKIP;
+ goto cleanup;
+ }
+
+ if (!(actual = virDomainDefFormat(info->vm->def, NULL, format_flags)))
+ goto cleanup;
+
+ ret = virTestCompareToFile(actual, xml);
+
+ cleanup:
+ VIR_FREE(xml);
+ VIR_FREE(actual);
+ return ret;
+}
+
+
+static int
+testCompareXMLToArgv(const void *data)
+{
+ struct testInfo *info = (void *) data;
char *xml = NULL;
char *args = NULL;
char *migrateURI = NULL;
ret = 0;
}
+ if (!(flags & FLAG_EXPECT_FAILURE) && ret == 0)
+ VIR_STEAL_PTR(info->vm, vm);
+
cleanup:
VIR_FREE(log);
VIR_FREE(actualargv);
do { \
static struct testInfo info = { \
name, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
- false \
+ false, NULL \
}; \
info.skipLegacyCPUs = skipLegacyCPUs; \
if (testInitQEMUCaps(&info, gic) < 0) \
if (virTestRun("QEMU XML-2-ARGV " name, \
testCompareXMLToArgv, &info) < 0) \
ret = -1; \
+ if (info.vm && virTestRun("QEMU XML-2-startup-XML " name, \
+ testCompareXMLToStartupXML, &info) < 0) \
+ ret = -1; \
virObjectUnref(info.qemuCaps); \
+ virObjectUnref(info.vm); \
} while (0)
# define DO_TEST(name, ...) \
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</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 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-system-i686</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <shareable/>
+ <serial>XYZXYZXYZYXXYZYZYXYZY</serial>
+ <alias name='ide0-0-0'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <disk type='block' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ <alias name='ide0-1-0'/>
+ <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <alias name='usb'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='ide' index='0'>
+ <alias name='ide'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'>
+ <alias name='pci.0'/>
+ </controller>
+ <input type='mouse' bus='ps2'>
+ <alias name='input0'/>
+ </input>
+ <input type='keyboard' bus='ps2'>
+ <alias name='input1'/>
+ </input>
+ <memballoon model='virtio'>
+ <alias name='balloon0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>