qemumemlocktest: Use real capabilities

Use testQemuGetRealCaps to fetch real capabilities and use it in place
of the faked caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-03-09 09:21:13 +01:00
parent 83967a9ed2
commit d8ea6a391b

View File

@ -45,8 +45,15 @@ testCompareMemLock(const void *data)
static int
mymain(void)
{
g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps();
g_autoptr(GHashTable) capscache = virHashNew(virObjectUnref);
g_autoptr(virQEMUCaps) qemuCaps_x86_64 = NULL;
g_autoptr(virQEMUCaps) qemuCaps_ppc64 = NULL;
int ret = 0;
g_autoptr(virQEMUCaps) qemuCaps = NULL;
if (!(qemuCaps_x86_64 = testQemuGetRealCaps("x86_64", "latest", "", capslatest, capscache, NULL, NULL)) ||
!(qemuCaps_ppc64 = testQemuGetRealCaps("ppc64", "latest", "", capslatest, capscache, NULL, NULL)))
return EXIT_FAILURE;
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
@ -78,18 +85,15 @@ mymain(void)
qemuTestSetHostArch(&driver, VIR_ARCH_X86_64);
DO_TEST("pc-kvm", 0);
DO_TEST("pc-tcg", 0);
qemuCaps = virQEMUCapsNew();
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI);
if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps) < 0) {
virFileCacheClear(driver.qemuCapsCache);
if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps_x86_64) < 0) {
ret = -1;
goto cleanup;
};
DO_TEST("pc-kvm", 0);
DO_TEST("pc-tcg", 0);
DO_TEST("pc-hardlimit", 2147483648);
DO_TEST("pc-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
DO_TEST("pc-hostdev", 2147483648);
@ -100,9 +104,8 @@ mymain(void)
DO_TEST("pc-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
qemuTestSetHostArch(&driver, VIR_ARCH_PPC64);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps) < 0) {
virFileCacheClear(driver.qemuCapsCache);
if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps_ppc64) < 0) {
ret = -1;
goto cleanup;
};