testQemuInfoSetArgs: Strip default machine alias only for 'latest' test cases

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>
This commit is contained in:
Peter Krempa 2021-05-17 10:51:15 +02:00
parent 5663be9f3a
commit 0dc45670f1

View 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 */