]> xenbits.xensource.com Git - libvirt.git/commitdiff
test_driver: Make callers of testOpenParse ensure the root element name
authorPeter Krempa <pkrempa@redhat.com>
Fri, 23 Sep 2022 13:16:22 +0000 (15:16 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 6 Oct 2022 08:54:25 +0000 (10:54 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/test/test_driver.c

index 373e5f78468c8e38360c80509b7df0f3a317d17a..8675f8ad07726b797a1f11dd93e0b433b2d68e16 100644 (file)
@@ -1306,12 +1306,6 @@ testOpenParse(testDriver *privconn,
               const char *file,
               xmlXPathContextPtr ctxt)
 {
-    if (!virXMLNodeNameEqual(ctxt->node, "node")) {
-        virReportError(VIR_ERR_XML_ERROR, "%s",
-                       _("Root element is not 'node'"));
-        return -1;
-    }
-
     if (testParseNodeInfo(&privconn->nodeInfo, ctxt) < 0)
         return -1;
     if (testParseDomains(privconn, file, ctxt) < 0)
@@ -1348,7 +1342,7 @@ testOpenFromFile(virConnectPtr conn, const char *file)
     if (!(privconn->caps = testBuildCapabilities(conn)))
         goto error;
 
-    if (!(doc = virXMLParseFileCtxt(file, &ctxt)))
+    if (!(doc = virXMLParse(file, NULL, NULL, "node", &ctxt, NULL, false)))
         goto error;
 
     privconn->numCells = 0;
@@ -1411,8 +1405,8 @@ testOpenDefault(virConnectPtr conn)
     if (!(privconn->caps = testBuildCapabilities(conn)))
         goto error;
 
-    if (!(doc = virXMLParseStringCtxt(defaultConnXML,
-                                      _("(test driver)"), &ctxt)))
+    if (!(doc = virXMLParse(NULL, defaultConnXML, _("(test driver)"),
+                            "node", &ctxt, NULL, false)))
         goto error;
 
     if (testOpenParse(privconn, NULL, ctxt) < 0)