[PATCH 01/13] domaincapsmock: Drop link time dependency on virQEMUCapsGet()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While Linux linker has no trouble resolving the symbols, valgrind
does. It has probably something to do with the fact that we don't
tell what symbols to export from mock libraries. Anyway, just
resolve the symbol at runtime.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/domaincapsmock.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/domaincapsmock.c b/tests/domaincapsmock.c
index 6ae0c4ad45..73ff992ebd 100644
--- a/tests/domaincapsmock.c
+++ b/tests/domaincapsmock.c
@@ -49,16 +49,19 @@ virHostCPUGetPhysAddrSize(const virArch hostArch,
 
 #if WITH_QEMU
 static bool (*real_virQEMUCapsGetKVMSupportsSecureGuest)(virQEMUCaps *qemuCaps);
+static bool (*real_virQEMUCapsGet)(virQEMUCaps *qemuCaps, virQEMUCapsFlags flag);
 
 bool
 virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps)
 {
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT) &&
-        virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST))
-        return true;
-
-    if (!real_virQEMUCapsGetKVMSupportsSecureGuest)
+    if (!real_virQEMUCapsGet) {
+        VIR_MOCK_REAL_INIT(virQEMUCapsGet);
         VIR_MOCK_REAL_INIT(virQEMUCapsGetKVMSupportsSecureGuest);
+    }
+
+    if (real_virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT) &&
+        real_virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST))
+        return true;
 
     return real_virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps);
 }
-- 
2.43.2
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux