]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemumemlocktest: Use real capabilities
authorPeter Krempa <pkrempa@redhat.com>
Thu, 9 Mar 2023 08:21:13 +0000 (09:21 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 3 Apr 2023 07:19:07 +0000 (09:19 +0200)
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>
tests/qemumemlocktest.c

index efed2324077af203d5fda56504d7d061badfac5d..61b73e1d793364e3755766d0d5253be86902eaac 100644 (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;
     };