]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuxml2argvtest: Don't insert capabilities into cache twice
authorPeter Krempa <pkrempa@redhat.com>
Tue, 4 Jan 2022 17:21:36 +0000 (18:21 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 7 Jan 2022 08:25:14 +0000 (09:25 +0100)
Fake capabilities are inserted twice, as in a few tests the architecture
is not present in the XML (testing filling in of the architecture).
Since we already know which architecture will be picked we don't need to
be adding the capabilities twice.

This doesn't impact the tests as they use the same approach to determine
the default arch.

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

index 3a4d10fa6e1ff6e0eda5b49b3c84b2ed50843e02..b5bd1542cd028ce89c7dcfd2358651d204ba88bf 100644 (file)
@@ -760,11 +760,11 @@ testCompareXMLToArgv(const void *data)
 
     ctxt->node = root;
 
-    if ((archstr = virXPathString("string(./os/type[1]/@arch)", ctxt))) {
-        if ((arch = virArchFromString(archstr)) == VIR_ARCH_NONE) {
-            arch = virArchFromHost();
-        }
-    }
+    if ((archstr = virXPathString("string(./os/type[1]/@arch)", ctxt)))
+        arch = virArchFromString(archstr);
+
+    if (arch == VIR_ARCH_NONE)
+        arch = virArchFromHost();
 
     if (!(info->flags & FLAG_REAL_CAPS)) {
         if (testUpdateQEMUCaps(info, arch, driver.caps) < 0)
@@ -823,13 +823,6 @@ testCompareXMLToArgv(const void *data)
     if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0)
         goto cleanup;
 
-    if (!(info->flags & FLAG_REAL_CAPS)) {
-        if (testUpdateQEMUCaps(info, vm->def->os.arch, driver.caps) < 0)
-            goto cleanup;
-        if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
-            goto cleanup;
-    }
-
     virResetLastError();
 
     if (!(cmd = testCompareXMLToArgvCreateArgs(&driver, vm, migrateURI, info,