diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c index 0596783b6c..e2989c05aa 100644 --- a/tests/qemusecuritytest.c +++ b/tests/qemusecuritytest.c @@ -64,6 +64,8 @@ prepareObjects(virQEMUDriver *driver, if (!(priv->qemuCaps = qemuTestParseCapabilitiesArch(VIR_ARCH_X86_64, latestCapsFile))) return -1; + virFileCacheClear(driver->qemuCapsCache); + if (qemuTestCapsCacheInsert(driver->qemuCapsCache, priv->qemuCaps) < 0) return -1; diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c index 408955a8f5..c689ab3b03 100644 --- a/tests/qemustatusxml2xmltest.c +++ b/tests/qemustatusxml2xmltest.c @@ -26,6 +26,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque) if (testQemuInfoInitArgs((struct testQemuInfo *) data) < 0) return -1; + virFileCacheClear(driver.qemuCapsCache); + if (qemuTestCapsCacheInsert(driver.qemuCapsCache, data->qemuCaps) < 0) return -1; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6f2ac9ee2a..fc0f7830a9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -664,6 +664,8 @@ testCompareXMLToArgv(const void *data) goto cleanup; } + virFileCacheClear(driver.qemuCapsCache); + if (info->args.hostOS == HOST_OS_MACOS) rc = qemuTestCapsCacheInsertMacOS(driver.qemuCapsCache, info->qemuCaps); else diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 05a94dbf4f..28ece10349 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -44,6 +44,8 @@ testXML2XMLCommon(const struct testQemuInfo *info) if (!(info->flags & FLAG_REAL_CAPS)) virQEMUCapsInitQMPBasicArch(info->qemuCaps); + virFileCacheClear(driver.qemuCapsCache); + if (info->args.hostOS == HOST_OS_MACOS) rc = qemuTestCapsCacheInsertMacOS(driver.qemuCapsCache, info->qemuCaps); else diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index d715252aee..e15130492e 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -527,17 +527,16 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache, size_t i; if (caps && virQEMUCapsGetArch(caps) != VIR_ARCH_NONE) { - /* for capabilities which have architecture set we populate only the - * given architecture and poison all other so that the test doesn't - * accidentally test a weird combination */ + /* all tests using real caps or arcitecture are expected to call: + * + * virFileCacheClear(driver.qemuCapsCache); + * + * before populating the cache; + */ virArch arch = virQEMUCapsGetArch(caps); - g_autoptr(virQEMUCaps) emptyCaps = virQEMUCapsNew(); g_autoptr(virQEMUCaps) copyCaps = NULL; virQEMUCaps *effCaps = caps; - if (!emptyCaps) - return -1; - if (arch_alias[arch] != VIR_ARCH_NONE) arch = arch_alias[arch]; @@ -553,18 +552,6 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache, if (qemuTestCapsCacheInsertData(cache, qemu_emulators[arch], effCaps) < 0) return -1; } - - - for (i = 0; i < G_N_ELEMENTS(qemu_emulators); i++) { - if (!qemu_emulators[i]) - continue; - - if (i == arch) - continue; - - if (qemuTestCapsCacheInsertData(cache, qemu_emulators[i], emptyCaps) < 0) - return -1; - } } else { /* in case when caps are missing or are missing architecture, we populate * everything */