[PATCH] tests: libxl: Mock xs_open and xs_close

Jim Fehlig posted 1 patch 2 years, 11 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210517222803.4220-1-jfehlig@suse.com
tests/libxlmock.c | 11 +++++++++++
1 file changed, 11 insertions(+)
[PATCH] tests: libxl: Mock xs_open and xs_close
Posted by Jim Fehlig 2 years, 11 months ago
The Xen-related unit tests are failing against the recently released
Xen 4.15. Xen commit 90c9f9f4dd changed the implementation of
libxl_ctx_alloc to use xs_open instead of xs_daemon_open. libvirt has
already mocked xs_daemon-{open,close} and others to allow using libxl
in confined build environments. This patch adds xs_{open,close} to the
list of functions mocked in libxlmock.c

https://github.com/xen-project/xen/commit/90c9f9f4ddd55e11be0506bff10c6237507c6e0d

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 tests/libxlmock.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/libxlmock.c b/tests/libxlmock.c
index 604dc4bfbe..a52d4bc2ed 100644
--- a/tests/libxlmock.c
+++ b/tests/libxlmock.c
@@ -39,6 +39,14 @@ VIR_MOCK_IMPL_RET_VOID(xs_daemon_open,
     return (void*)0x1;
 }
 
+VIR_MOCK_IMPL_RET_ARGS(xs_open,
+                       struct xs_handle *,
+                       unsigned long, flags)
+{
+    VIR_MOCK_REAL_INIT(xs_open);
+    return (void*)0x1;
+}
+
 VIR_MOCK_IMPL_RET_ARGS(xc_interface_open,
                        xc_interface *,
                        xentoollog_logger *, logger,
@@ -94,6 +102,9 @@ VIR_MOCK_STUB_RET_ARGS(xc_sharing_used_frames,
 VIR_MOCK_STUB_VOID_ARGS(xs_daemon_close,
                         struct xs_handle *, handle)
 
+VIR_MOCK_STUB_VOID_ARGS(xs_close,
+                        struct xs_handle *, xsh)
+
 VIR_MOCK_STUB_RET_ARGS(bind,
                        int, 0,
                        int, sockfd,
-- 
2.31.1


Re: [PATCH] tests: libxl: Mock xs_open and xs_close
Posted by Michal Prívozník 2 years, 11 months ago
On 5/18/21 12:28 AM, Jim Fehlig wrote:
> The Xen-related unit tests are failing against the recently released
> Xen 4.15. Xen commit 90c9f9f4dd changed the implementation of
> libxl_ctx_alloc to use xs_open instead of xs_daemon_open. libvirt has
> already mocked xs_daemon-{open,close} and others to allow using libxl
> in confined build environments. This patch adds xs_{open,close} to the
> list of functions mocked in libxlmock.c
> 
> https://github.com/xen-project/xen/commit/90c9f9f4ddd55e11be0506bff10c6237507c6e0d
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  tests/libxlmock.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal