]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: fix compiling tests with minGW
authorPavel Hrdina <phrdina@redhat.com>
Thu, 22 Jul 2021 09:45:38 +0000 (11:45 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Thu, 22 Jul 2021 13:07:17 +0000 (15:07 +0200)
We need to mock virQEMUCapsGetKVMSupportsSecureGuest only if compiling
with QEMU otherwise compilation will fail with error:

/usr/lib/gcc/i686-w64-mingw32/11.1.1/../../../../i686-w64-mingw32/bin/ld: tests/libdomaincapsmock.dll.p/domaincapsmock.c.obj: in function `virQEMUCapsGetKVMSupportsSecureGuest':
/builds/libvirt/libvirt/build/../tests/domaincapsmock.c:40: undefined reference to `virQEMUCapsGet'
/usr/lib/gcc/i686-w64-mingw32/11.1.1/../../../../i686-w64-mingw32/bin/ld: /builds/libvirt/libvirt/build/../tests/domaincapsmock.c:41: undefined reference to `virQEMUCapsGet'

Fixes: 248a30c0c0ec2610e8fa2bbbc98da6d06978ad2e
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/domaincapsmock.c

index 7b02c0e8902215a4cddcdeb2d692398913ce0845..0a6c541f77fcb585cf33b9f30fc01c39138c52ee 100644 (file)
 #include <config.h>
 
 #include "virhostcpu.h"
-#include "virmock.h"
-#include "qemu/qemu_capabilities.h"
+
+#if WITH_QEMU
+# include "virmock.h"
+# include "qemu/qemu_capabilities.h"
+#endif
 
 int
 virHostCPUGetKVMMaxVCPUs(void)
@@ -32,6 +35,7 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED)
     return 0;
 }
 
+#if WITH_QEMU
 static bool (*real_virQEMUCapsGetKVMSupportsSecureGuest)(virQEMUCaps *qemuCaps);
 
 bool
@@ -46,3 +50,4 @@ virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps)
 
     return real_virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps);
 }
+#endif