]> xenbits.xensource.com Git - libvirt.git/commitdiff
testQemuInfoSetArgs: Strip default machine alias only for 'latest' test cases
authorPeter Krempa <pkrempa@redhat.com>
Mon, 17 May 2021 08:51:15 +0000 (10:51 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 19 May 2021 08:19:47 +0000 (10:19 +0200)
For the real-capabilities test cases testing 'latest' capabilities we
strip off the alias from 'pc' to the appropriate versioned machine type
to prevent update to all tests when bumping qemu capabilities.

Recenly we also started caching the capabilities to prevent re-parsing
the XML all the time. The commit adding the caching kept the alias
stripping prior to cache insertion, thus the cache contains the stripped
alias.

This leads to problem when a test case is added where the 'latest'
equals to the selected version.

Move the machine alias stripping after we create a local copy thus
stripping it only for 'latest' tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
tests/testutilsqemu.c

index 1a3eae2c07a2c78425b39bbbe0690a30fcd90438..1444abc401d9838107df21bb0699c75c81e514d2 100644 (file)
@@ -790,9 +790,6 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
             if (!(qemuCaps = qemuTestParseCapabilitiesArch(info->arch, capsfile)))
                 goto cleanup;
 
-            if (stripmachinealiases)
-                virQEMUCapsStripMachineAliases(qemuCaps);
-
             cachedcaps = qemuCaps;
 
             g_hash_table_insert(capscache, g_strdup(capsfile), g_steal_pointer(&qemuCaps));
@@ -801,6 +798,9 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
         if (!(qemuCaps = virQEMUCapsNewCopy(cachedcaps)))
             goto cleanup;
 
+        if (stripmachinealiases)
+            virQEMUCapsStripMachineAliases(qemuCaps);
+
         info->flags |= FLAG_REAL_CAPS;
 
         /* provide path to the replies file for schema testing */