]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: libxl: do not run the emulator
authorJán Tomko <jtomko@redhat.com>
Sat, 22 Feb 2020 12:56:19 +0000 (13:56 +0100)
committerJán Tomko <jtomko@redhat.com>
Tue, 25 Feb 2020 11:05:01 +0000 (12:05 +0100)
Ever since commit c5a00350 the libxl parser invokes the emulator
to probe which device model to use.

Commit b90c4b5 introduced a workaround that used a stable path
which was very likely to result in the answer matching the default.
However the test is still affected by the host state and the binary
gets invoked if present.

Mock the libxlDomainGetEmulatorType function to stop wasting CPU
cycles every time a 'make check' is run on a system with xen installed.

For example xlconfigtest gets faster by 90 %

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: b90c4b5f505698d600303c5b4f03f5d229b329dd
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_capabilities.h
tests/libxlmock.c

index 9a7c8bf6366beb9ef993e1b56cf4fce8e677ae9d..9efb8364291ea2c05deaa5273dd80bfd61206118 100644 (file)
@@ -50,4 +50,5 @@ libxlMakeDomainCapabilities(virDomainCapsPtr domCaps,
                             size_t nfirmwares);
 
 int
-libxlDomainGetEmulatorType(const virDomainDef *def);
+libxlDomainGetEmulatorType(const virDomainDef *def)
+    G_GNUC_NO_INLINE;
index 60e6b78129673ec1daf0ec72fa7fa91dadf73b3d..a36ca135f61320cde63609fb29c34483f8f18497 100644 (file)
@@ -30,6 +30,7 @@
 
 # include "virfile.h"
 # include "virsocket.h"
+# include "libxl/libxl_capabilities.h"
 
 VIR_MOCK_IMPL_RET_VOID(xs_daemon_open,
                        struct xs_handle *)
@@ -123,4 +124,10 @@ VIR_MOCK_IMPL_RET_ARGS(stat, int,
     return real_stat(path, sb);
 }
 
+int
+libxlDomainGetEmulatorType(const virDomainDef *def G_GNUC_UNUSED)
+{
+    return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
+}
+
 #endif /* WITH_LIBXL && WITH_YAJL */