From a97e17c4e23c88b58c20545196fdd56ced4be877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Sat, 22 Feb 2020 13:56:19 +0100 Subject: [PATCH] tests: libxl: do not run the emulator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Fixes: b90c4b5f505698d600303c5b4f03f5d229b329dd Reviewed-by: Jim Fehlig --- src/libxl/libxl_capabilities.h | 3 ++- tests/libxlmock.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_capabilities.h b/src/libxl/libxl_capabilities.h index 9a7c8bf636..9efb836429 100644 --- a/src/libxl/libxl_capabilities.h +++ b/src/libxl/libxl_capabilities.h @@ -50,4 +50,5 @@ libxlMakeDomainCapabilities(virDomainCapsPtr domCaps, size_t nfirmwares); int -libxlDomainGetEmulatorType(const virDomainDef *def); +libxlDomainGetEmulatorType(const virDomainDef *def) + G_GNUC_NO_INLINE; diff --git a/tests/libxlmock.c b/tests/libxlmock.c index 60e6b78129..a36ca135f6 100644 --- a/tests/libxlmock.c +++ b/tests/libxlmock.c @@ -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 */