From: Nehal J Wani Date: Tue, 18 Mar 2014 23:08:12 +0000 (+0530) Subject: qemuhotplugtest: Fix mem-leaking testcases X-Git-Tag: v1.2.3-rc1~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ab0f7e3b788a66702cadfc9c32bd95a97e788cf;p=thirdparty%2Flibvirt.git qemuhotplugtest: Fix mem-leaking testcases While running qemuhotplugtest, it was found that valgrind pointed out the following memory leak: ==7906== 5 bytes in 1 blocks are definitely lost in loss record 7 of 121 ==7906== at 0x4A069EE: malloc (vg_replace_malloc.c:270) ==7906== by 0x3E782A754D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6) ==7906== by 0x4CDAE03: virDomainDeviceInfoParseXML.isra.32 (domain_conf.c:3685) ==7906== by 0x4CE3BB9: virDomainNetDefParseXML (domain_conf.c:6707) ==7906== by 0x4CFBA08: virDomainDefParseXML (domain_conf.c:12235) ==7906== by 0x4CFBC1E: virDomainDefParseNode (domain_conf.c:13039) ==7906== by 0x4CFBD95: virDomainDefParse (domain_conf.c:12981) ==7906== by 0x41FEB4: testQemuHotplug (qemuhotplugtest.c:66) ==7906== by 0x420F41: virtTestRun (testutils.c:201) ==7906== by 0x41F287: mymain (qemuhotplugtest.c:422) ==7906== by 0x4216BD: virtTestMain (testutils.c:784) ==7906== by 0x3E6CE1ED1C: (below main) (libc-start.c:226) ...and 10 more. Problem is, since 20745748 we do both, parse elements from XML files and call qemuAssignDeviceAliases(). While generating runtime info for domain at runtime is just fine in the test, we can parse just inactive XML and remove all -es from the XML files. Signed-off-by: Michal Privoznik --- diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 8036adc1bd..4ef81e079d 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -67,7 +67,7 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt, driver.caps, driver.xmlopt, QEMU_EXPECTED_VIRT_TYPES, - 0))) + VIR_DOMAIN_XML_INACTIVE))) goto cleanup; priv = (*vm)->privateData; diff --git a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml index 25fc120f63..ec1c6e8f7e 100644 --- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml +++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml @@ -1,4 +1,4 @@ - + f17 a1cd52eb-d37f-4717-fc6e-972f0774f4c9 1048576 @@ -30,7 +30,6 @@ -
@@ -38,22 +37,16 @@ -
-
-
- - - + -
@@ -63,62 +56,45 @@ - -
- - - - - - - + - - - -
- - - + - + -