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 <pkre...@redhat.com>
---
 tests/testutilsqemu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 1a3eae2c07..1444abc401 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -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 */
-- 
2.30.2

Reply via email to