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(a)redhat.com>
---
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