]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuxml2argvtest: Use virDomainDefParseFile instead of virXMLParse+virDomainDefParseNode
authorPeter Krempa <pkrempa@redhat.com>
Sat, 16 Dec 2023 08:05:09 +0000 (09:05 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 17 Jan 2024 16:31:12 +0000 (17:31 +0100)
As we don't do any additional parsing of the input file in
qemuxml2argvtest we can simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuxml2argvtest.c

index 8b9cb1c01a9635c5175f85a2d43a1cff6a210d5e..92808af9dc31fe4114959ef3c46b387efaf274a2 100644 (file)
@@ -616,8 +616,6 @@ testCompareXMLToArgv(const void *data)
     g_autofree char *log = NULL;
     g_autoptr(virCommand) cmd = NULL;
     qemuDomainObjPrivate *priv = NULL;
-    g_autoptr(xmlDoc) xml = NULL;
-    g_autoptr(xmlXPathContext) ctxt = NULL;
     g_autoptr(virIdentity) sysident = virIdentityGetSystem();
 
     /* mark test case as used */
@@ -669,10 +667,6 @@ testCompareXMLToArgv(const void *data)
     if (testCheckExclusiveFlags(info->flags) < 0)
         goto cleanup;
 
-    if (!(xml = virXMLParse(info->infile, NULL, "(domain_definition)",
-                            "domain", &ctxt, NULL, false)))
-        goto cleanup;
-
     virFileCacheClear(driver.qemuCapsCache);
 
     if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
@@ -702,7 +696,7 @@ testCompareXMLToArgv(const void *data)
 
     parseFlags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
 
-    if (!(vm->def = virDomainDefParseNode(ctxt, driver.xmlopt, NULL, parseFlags))) {
+    if (!(vm->def = virDomainDefParseFile(info->infile, driver.xmlopt, NULL, parseFlags))) {
         err = virGetLastError();
         if (!err) {
             VIR_TEST_DEBUG("no error was reported for expected parse error");