]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
tests: Use *DefParseFile more
authorCole Robinson <crobinso@redhat.com>
Thu, 23 Apr 2015 15:10:15 +0000 (11:10 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 23 Apr 2015 21:08:48 +0000 (17:08 -0400)
18 files changed:
tests/bhyvexml2xmltest.c
tests/domainconftest.c
tests/lxcxml2xmltest.c
tests/networkxml2conftest.c
tests/networkxml2xmltest.c
tests/networkxml2xmlupdatetest.c
tests/nwfilterxml2xmltest.c
tests/qemuagenttest.c
tests/secretxml2xmltest.c
tests/securityselinuxlabeltest.c
tests/storagebackendsheepdogtest.c
tests/storagepoolxml2xmltest.c
tests/storagevolxml2argvtest.c
tests/storagevolxml2xmltest.c
tests/xlconfigtest.c
tests/xmconfigtest.c
tests/xml2sexprtest.c
tests/xml2vmxtest.c

index 2e742cf690a77c1185d76d139f33de4053c25409..740c9573f3453bf2f2b4da9dadde53babb32f79e 100644 (file)
@@ -14,20 +14,16 @@ static bhyveConn driver;
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
 {
-    char *inXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     virDomainDefPtr def = NULL;
     int ret = -1;
 
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
-
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;
 
-    if (!(def = virDomainDefParseString(inXmlData, driver.caps, driver.xmlopt,
-                                        VIR_DOMAIN_DEF_PARSE_INACTIVE)))
+    if (!(def = virDomainDefParseFile(inxml, driver.caps, driver.xmlopt,
+                                      VIR_DOMAIN_DEF_PARSE_INACTIVE)))
         goto fail;
 
     if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
@@ -41,7 +37,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
     ret = 0;
 
  fail:
-    VIR_FREE(inXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
     virDomainDefFree(def);
index b27dd145ededd10e56c6d17b2a89e7f21f89bf23..53c40c13102313121874ef6c62e3c700e2178587 100644 (file)
@@ -43,7 +43,6 @@ struct testGetFilesystemData {
 static int testGetFilesystem(const void *opaque)
 {
     int ret = -1;
-    char *xmlData = NULL;
     virDomainDefPtr def = NULL;
     char *filename = NULL;
     const struct testGetFilesystemData *data = opaque;
@@ -53,10 +52,7 @@ static int testGetFilesystem(const void *opaque)
                     abs_srcdir, data->filename) < 0)
         goto cleanup;
 
-    if (virtTestLoadFile(filename, &xmlData) < 0)
-        goto cleanup;
-
-    if (!(def = virDomainDefParseString(xmlData, caps, xmlopt, 0)))
+    if (!(def = virDomainDefParseFile(filename, caps, xmlopt, 0)))
         goto cleanup;
 
     fsdef = virDomainGetFilesystemForTarget(def,
@@ -79,7 +75,6 @@ static int testGetFilesystem(const void *opaque)
 
  cleanup:
     virDomainDefFree(def);
-    VIR_FREE(xmlData);
     VIR_FREE(filename);
     return ret;
 }
index 37997f51bf7c7f8ad09aa5f294d2c57a5bb5f2aa..a9b541953079b1ac674009ea09132d7c028c8c42 100644 (file)
@@ -25,19 +25,16 @@ static virDomainXMLOptionPtr xmlopt;
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
 {
-    char *inXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     int ret = -1;
     virDomainDefPtr def = NULL;
 
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;
 
-    if (!(def = virDomainDefParseString(inXmlData, caps, xmlopt,
-                                        live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE)))
+    if (!(def = virDomainDefParseFile(inxml, caps, xmlopt,
+                                      live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE)))
         goto fail;
 
     if (!virDomainDefCheckABIStability(def, def)) {
@@ -55,7 +52,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
 
     ret = 0;
  fail:
-    VIR_FREE(inXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
     virDomainDefFree(def);
index 6df161f3b1a73b36bd7790975c8a9602abda4de0..1d9a772bfa1b9e0c469bc41a6418835a799d9610 100644 (file)
@@ -21,7 +21,6 @@
 static int
 testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr caps)
 {
-    char *inXmlData = NULL;
     char *outConfData = NULL;
     char *actual = NULL;
     int ret = -1;
@@ -31,13 +30,10 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr
     char *pidfile = NULL;
     dnsmasqContext *dctx = NULL;
 
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
-
     if (virtTestLoadFile(outconf, &outConfData) < 0)
         goto fail;
 
-    if (!(dev = virNetworkDefParseString(inXmlData)))
+    if (!(dev = virNetworkDefParseFile(inxml)))
         goto fail;
 
     if (!(obj = virNetworkObjNew()))
@@ -61,7 +57,6 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr
     ret = 0;
 
  fail:
-    VIR_FREE(inXmlData);
     VIR_FREE(outConfData);
     VIR_FREE(actual);
     VIR_FREE(pidfile);
index 34a52112815354abae597fccca79d6badd110f4f..467be2af9c9e059f250620117f2e9c79489cdb80 100644 (file)
@@ -20,18 +20,15 @@ static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
                          unsigned int flags)
 {
-    char *inXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     int ret = -1;
     virNetworkDefPtr dev = NULL;
 
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;
 
-    if (!(dev = virNetworkDefParseString(inXmlData)))
+    if (!(dev = virNetworkDefParseFile(inxml)))
         goto fail;
 
     if (!(actual = virNetworkDefFormat(dev, flags)))
@@ -45,7 +42,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
     ret = 0;
 
  fail:
-    VIR_FREE(inXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
     virNetworkDefFree(dev);
index f34638a61b11ac74f437a7af589310502f784727..2051a0110ecefc5766a5afa75f7f1b147e38f65d 100644 (file)
@@ -22,19 +22,16 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
                          unsigned int command, unsigned int section,
                          int parentIndex, bool expectFailure)
 {
-    char *netXmlData = NULL;
     char *updateXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     int ret = -1;
     virNetworkDefPtr def = NULL;
 
-    if (virtTestLoadFile(netxml, &netXmlData) < 0)
-        goto error;
     if (virtTestLoadFile(updatexml, &updateXmlData) < 0)
         goto error;
 
-    if (!(def = virNetworkDefParseString(netXmlData)))
+    if (!(def = virNetworkDefParseFile(netxml)))
         goto fail;
 
     if (virNetworkDefUpdateSection(def, command, section, parentIndex,
@@ -67,7 +64,6 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
         }
     }
  error:
-    VIR_FREE(netXmlData);
     VIR_FREE(updateXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
index ba1ead1abd89b259baf46b4da3078b5287a4d129..7640af0ccea7ea4158741e98b6a2919eedc691ca 100644 (file)
@@ -23,20 +23,17 @@ static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
                          bool expect_error)
 {
-    char *inXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     int ret = -1;
     virNWFilterDefPtr dev = NULL;
 
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;
 
     virResetLastError();
 
-    if (!(dev = virNWFilterDefParseString(inXmlData))) {
+    if (!(dev = virNWFilterDefParseFile(inxml))) {
         if (expect_error) {
             virResetLastError();
             goto done;
@@ -56,7 +53,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
     ret = 0;
 
  fail:
-    VIR_FREE(inXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
     virNWFilterDefFree(dev);
index 4410ffe81d53b8142139a05c21e0de27dedcb4f3..52cc8343bba858229d9400fe0ddef54e070373b1 100644 (file)
@@ -170,7 +170,6 @@ testQemuAgentGetFSInfo(const void *data)
     virCapsPtr caps = testQemuCapsInit();
     qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt);
     char *domain_filename = NULL;
-    char *domain_xml = NULL;
     virDomainDefPtr def = NULL;
     virDomainFSInfoPtr *info = NULL;
     int ret = -1, ninfo = 0, i;
@@ -182,11 +181,8 @@ testQemuAgentGetFSInfo(const void *data)
                     abs_srcdir) < 0)
         goto cleanup;
 
-    if (virtTestLoadFile(domain_filename, &domain_xml) < 0)
-        goto cleanup;
-
-    if (!(def = virDomainDefParseString(domain_xml, caps, xmlopt,
-                                        VIR_DOMAIN_DEF_PARSE_INACTIVE)))
+    if (!(def = virDomainDefParseFile(domain_filename, caps, xmlopt,
+                                      VIR_DOMAIN_DEF_PARSE_INACTIVE)))
         goto cleanup;
 
     if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
@@ -297,7 +293,6 @@ testQemuAgentGetFSInfo(const void *data)
         virDomainFSInfoFree(info[i]);
     VIR_FREE(info);
     VIR_FREE(domain_filename);
-    VIR_FREE(domain_xml);
     virObjectUnref(caps);
     virDomainDefFree(def);
     qemuMonitorTestFree(test);
index c9d879e1af21dea7001a97599608c756591c2bf7..cf5f00fc5b8c4b4706d58d3bb7baec7b0d80909f 100644 (file)
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
 {
-    char *inXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     int ret = -1;
     virSecretDefPtr secret = NULL;
 
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;
 
-    if (!(secret = virSecretDefParseString(inXmlData)))
+    if (!(secret = virSecretDefParseFile(inxml)))
         goto fail;
 
     if (!(actual = virSecretDefFormat(secret)))
@@ -36,7 +33,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
     ret = 0;
 
  fail:
-    VIR_FREE(inXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
     virSecretDefFree(secret);
index 730f7beb7be31d5f4964524496270de8ddcf833a..85fad370bfba169681ce8ba97910be223f4e7311 100644 (file)
@@ -182,7 +182,6 @@ static virDomainDefPtr
 testSELinuxLoadDef(const char *testname)
 {
     char *xmlfile = NULL;
-    char *xmlstr = NULL;
     virDomainDefPtr def = NULL;
     size_t i;
 
@@ -190,10 +189,7 @@ testSELinuxLoadDef(const char *testname)
                     abs_srcdir, testname) < 0)
         goto cleanup;
 
-    if (virFileReadAll(xmlfile, 1024*1024, &xmlstr) < 0)
-        goto cleanup;
-
-    if (!(def = virDomainDefParseString(xmlstr, caps, xmlopt, 0)))
+    if (!(def = virDomainDefParseFile(xmlfile, caps, xmlopt, 0)))
         goto cleanup;
 
     for (i = 0; i < def->ndisks; i++) {
@@ -230,7 +226,6 @@ testSELinuxLoadDef(const char *testname)
 
  cleanup:
     VIR_FREE(xmlfile);
-    VIR_FREE(xmlstr);
     return def;
 }
 
index c85a9b449250a927bf763161d1c3b8a8d9a74c6b..7744119bc928736dc0eccd41f01fe73e69d2887f 100644 (file)
@@ -50,13 +50,9 @@ test_node_info_parser(collie_test test, char *poolxml)
 {
     int ret = -1;
     char *output = NULL;
-    char *poolXmlData = NULL;
     virStoragePoolDefPtr pool = NULL;
 
-    if (virtTestLoadFile(poolxml, &poolXmlData) < 0)
-        goto cleanup;
-
-    if (!(pool = virStoragePoolDefParseString(poolXmlData)))
+    if (!(pool = virStoragePoolDefParseFile(poolxml)))
         goto cleanup;
 
     if (VIR_STRDUP(output, test.output) < 0)
@@ -77,7 +73,6 @@ test_node_info_parser(collie_test test, char *poolxml)
 
  cleanup:
     VIR_FREE(output);
-    VIR_FREE(poolXmlData);
     virStoragePoolDefFree(pool);
     return ret;
 }
@@ -86,21 +81,14 @@ static int
 test_vdi_list_parser(collie_test test, char *poolxml, char *volxml)
 {
     int ret = -1;
-    char *poolXmlData = NULL;
-    char *volXmlData = NULL;
     char *output = NULL;
     virStoragePoolDefPtr pool = NULL;
     virStorageVolDefPtr vol = NULL;
 
-    if (virtTestLoadFile(poolxml, &poolXmlData) < 0)
-        goto cleanup;
-    if (virtTestLoadFile(volxml, &volXmlData) < 0)
-        goto cleanup;
-
-    if (!(pool = virStoragePoolDefParseString(poolXmlData)))
+    if (!(pool = virStoragePoolDefParseFile(poolxml)))
         goto cleanup;
 
-    if (!(vol = virStorageVolDefParseString(pool, volXmlData, 0)))
+    if (!(vol = virStorageVolDefParseFile(pool, volxml, 0)))
         goto cleanup;
 
     if (VIR_STRDUP(output, test.output) < 0)
@@ -121,8 +109,6 @@ test_vdi_list_parser(collie_test test, char *poolxml, char *volxml)
 
  cleanup:
     VIR_FREE(output);
-    VIR_FREE(poolXmlData);
-    VIR_FREE(volXmlData);
     virStoragePoolDefFree(pool);
     virStorageVolDefFree(vol);
     return ret;
index 270f75d982ee1968294bc2a701f6e5c29f6bdf03..54b2a00b0411445c1620463ff5a20b92d16e6433 100644 (file)
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
 {
-    char *inXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     int ret = -1;
     virStoragePoolDefPtr dev = NULL;
 
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;
 
-    if (!(dev = virStoragePoolDefParseString(inXmlData)))
+    if (!(dev = virStoragePoolDefParseFile(inxml)))
         goto fail;
 
     if (!(actual = virStoragePoolDefFormat(dev)))
@@ -44,7 +41,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
     ret = 0;
 
  fail:
-    VIR_FREE(inXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
     virStoragePoolDefFree(dev);
index f5f86c829ca28cb0723dc22f321b1fe4f4687750..d957f6382b4224dae589daecc7ace61c0445a655 100644 (file)
@@ -43,10 +43,6 @@ testCompareXMLToArgvFiles(bool shouldFail,
                           int imgformat,
                           unsigned long parse_flags)
 {
-    char *volXmlData = NULL;
-    char *poolXmlData = NULL;
-    char *inputpoolXmlData = NULL;
-    char *inputvolXmlData = NULL;
     char *expectedCmdline = NULL;
     char *actualCmdline = NULL;
     int ret = -1;
@@ -65,34 +61,24 @@ testCompareXMLToArgvFiles(bool shouldFail,
     if (!(conn = virGetConnect()))
         goto cleanup;
 
-    if (virtTestLoadFile(poolxml, &poolXmlData) < 0)
-        goto cleanup;
-    if (virtTestLoadFile(volxml, &volXmlData) < 0)
-        goto cleanup;
-    if (inputvolxml &&
-        virtTestLoadFile(inputvolxml, &inputvolXmlData) < 0)
-        goto cleanup;
-
-    if (!(pool = virStoragePoolDefParseString(poolXmlData)))
+    if (!(pool = virStoragePoolDefParseFile(poolxml)))
         goto cleanup;
 
     poolobj.def = pool;
 
     if (inputpoolxml) {
-        if (virtTestLoadFile(inputpoolxml, &inputpoolXmlData) < 0)
-            goto cleanup;
-        if (!(inputpool = virStoragePoolDefParseString(inputpoolXmlData)))
+        if (!(inputpool = virStoragePoolDefParseFile(inputpoolxml)))
             goto cleanup;
     }
 
     if (inputvolxml)
         parse_flags |= VIR_VOL_XML_PARSE_NO_CAPACITY;
 
-    if (!(vol = virStorageVolDefParseString(pool, volXmlData, parse_flags)))
+    if (!(vol = virStorageVolDefParseFile(pool, volxml, parse_flags)))
         goto cleanup;
 
     if (inputvolxml &&
-        !(inputvol = virStorageVolDefParseString(inputpool, inputvolXmlData, 0)))
+        !(inputvol = virStorageVolDefParseFile(inputpool, inputvolxml, 0)))
         goto cleanup;
 
     testSetVolumeType(vol, pool);
@@ -133,10 +119,6 @@ testCompareXMLToArgvFiles(bool shouldFail,
     virCommandFree(cmd);
     VIR_FREE(actualCmdline);
     VIR_FREE(expectedCmdline);
-    VIR_FREE(inputpoolXmlData);
-    VIR_FREE(poolXmlData);
-    VIR_FREE(volXmlData);
-    VIR_FREE(inputvolXmlData);
     virObjectUnref(conn);
     return ret;
 }
index 0d6c818e0d83fc5c6c163bf99de96e17b7277edb..64b66738db782c7a1507dcb0583fbafa369d3188 100644 (file)
@@ -20,25 +20,19 @@ static int
 testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
                          const char *outxml, unsigned int flags)
 {
-    char *poolXmlData = NULL;
-    char *inXmlData = NULL;
     char *outXmlData = NULL;
     char *actual = NULL;
     int ret = -1;
     virStoragePoolDefPtr pool = NULL;
     virStorageVolDefPtr dev = NULL;
 
-    if (virtTestLoadFile(poolxml, &poolXmlData) < 0)
-        goto fail;
-    if (virtTestLoadFile(inxml, &inXmlData) < 0)
-        goto fail;
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;
 
-    if (!(pool = virStoragePoolDefParseString(poolXmlData)))
+    if (!(pool = virStoragePoolDefParseFile(poolxml)))
         goto fail;
 
-    if (!(dev = virStorageVolDefParseString(pool, inXmlData, flags)))
+    if (!(dev = virStorageVolDefParseFile(pool, inxml, flags)))
         goto fail;
 
     if (!(actual = virStorageVolDefFormat(pool, dev)))
@@ -52,8 +46,6 @@ testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
     ret = 0;
 
  fail:
-    VIR_FREE(poolXmlData);
-    VIR_FREE(inXmlData);
     VIR_FREE(outXmlData);
     VIR_FREE(actual);
     virStoragePoolDefFree(pool);
index 880656628b3cec8d9f8a30a31fbf717d6eb5df6b..899cb1b82be862871aeb8f836ca6a6de03dc4c08 100644 (file)
@@ -48,7 +48,6 @@ static virDomainXMLOptionPtr xmlopt;
 static int
 testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
 {
-    char *xmlData = NULL;
     char *xmcfgData = NULL;
     char *gotxmcfgData = NULL;
     virConfPtr conf = NULL;
@@ -63,14 +62,11 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
     conn = virGetConnect();
     if (!conn) goto fail;
 
-    if (virtTestLoadFile(xml, &xmlData) < 0)
-        goto fail;
-
     if (virtTestLoadFile(xmcfg, &xmcfgData) < 0)
         goto fail;
 
-    if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
-                                        VIR_DOMAIN_XML_INACTIVE)))
+    if (!(def = virDomainDefParseFile(xml, caps, xmlopt,
+                                      VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
 
     if (!virDomainDefCheckABIStability(def, def)) {
@@ -93,7 +89,6 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
     ret = 0;
 
  fail:
-    VIR_FREE(xmlData);
     VIR_FREE(xmcfgData);
     VIR_FREE(gotxmcfgData);
     if (conf)
index 2db012e043c6a7db70ce87f41f3fd160158a8f69..1d67c5b4e3fcf3ad18cb19f90a270517a4dd2116 100644 (file)
@@ -45,7 +45,6 @@ static virDomainXMLOptionPtr xmlopt;
 static int
 testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
 {
-    char *xmlData = NULL;
     char *xmcfgData = NULL;
     char *gotxmcfgData = NULL;
     virConfPtr conf = NULL;
@@ -61,9 +60,6 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
     conn = virGetConnect();
     if (!conn) goto fail;
 
-    if (virtTestLoadFile(xml, &xmlData) < 0)
-        goto fail;
-
     if (virtTestLoadFile(xmcfg, &xmcfgData) < 0)
         goto fail;
 
@@ -72,8 +68,8 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
     priv.caps = caps;
     conn->privateData = &priv;
 
-    if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
-                                        VIR_DOMAIN_DEF_PARSE_INACTIVE)))
+    if (!(def = virDomainDefParseFile(xml, caps, xmlopt,
+                                      VIR_DOMAIN_DEF_PARSE_INACTIVE)))
         goto fail;
 
     if (!virDomainDefCheckABIStability(def, def)) {
@@ -96,7 +92,6 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
     ret = 0;
 
  fail:
-    VIR_FREE(xmlData);
     VIR_FREE(xmcfgData);
     VIR_FREE(gotxmcfgData);
     if (conf)
index c70691474a189637334f1974a0f1ad8db7026927..32c8a32c3dd4ae110f9ec42ff853b54d4f4f46b3 100644 (file)
@@ -23,20 +23,16 @@ static virDomainXMLOptionPtr xmlopt;
 static int
 testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
 {
-  char *xmlData = NULL;
   char *sexprData = NULL;
   char *gotsexpr = NULL;
   int ret = -1;
   virDomainDefPtr def = NULL;
 
-  if (virtTestLoadFile(xml, &xmlData) < 0)
-      goto fail;
-
   if (virtTestLoadFile(sexpr, &sexprData) < 0)
       goto fail;
 
-  if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
-                                      VIR_DOMAIN_DEF_PARSE_INACTIVE)))
+  if (!(def = virDomainDefParseFile(xml, caps, xmlopt,
+                                    VIR_DOMAIN_DEF_PARSE_INACTIVE)))
       goto fail;
 
   if (!virDomainDefCheckABIStability(def, def)) {
@@ -55,7 +51,6 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
   ret = 0;
 
  fail:
-  VIR_FREE(xmlData);
   VIR_FREE(sexprData);
   VIR_FREE(gotsexpr);
   virDomainDefFree(def);
index b576f83cf43757a064eb62b5debad4493f41f9fe..6d7d4c23ce08b990b846c2b5ee89536a2c21cb8b 100644 (file)
@@ -73,19 +73,15 @@ static int
 testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
 {
     int result = -1;
-    char *xmlData = NULL;
     char *vmxData = NULL;
     char *formatted = NULL;
     virDomainDefPtr def = NULL;
 
-    if (virtTestLoadFile(xml, &xmlData) < 0)
-        goto failure;
-
     if (virtTestLoadFile(vmx, &vmxData) < 0)
         goto failure;
 
-    def = virDomainDefParseString(xmlData, caps, xmlopt,
-                                  VIR_DOMAIN_DEF_PARSE_INACTIVE);
+    def = virDomainDefParseFile(xml, caps, xmlopt,
+                                VIR_DOMAIN_DEF_PARSE_INACTIVE);
 
     if (def == NULL)
         goto failure;
@@ -108,7 +104,6 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
     result = 0;
 
  failure:
-    VIR_FREE(xmlData);
     VIR_FREE(vmxData);
     VIR_FREE(formatted);
     virDomainDefFree(def);