[PATCH 14/31] qemumemlocktest: Use real capabilities

Peter Krempa pkrempa at redhat.com
Thu Mar 30 13:38:08 UTC 2023


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

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/qemumemlocktest.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c
index efed232407..61b73e1d79 100644
--- a/tests/qemumemlocktest.c
+++ b/tests/qemumemlocktest.c
@@ -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;
     };
-- 
2.39.2



More information about the libvir-list mailing list