From 0dc45670f1be3efab0adf4f852f6b93b053119cb Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 17 May 2021 10:51:15 +0200 Subject: [PATCH] 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 Reviewed-by: Pavel Hrdina --- 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 */