[PATCH] virgdbusmock: Mock g_dbus_connection_call_with_unix_fd_list_sync() only on UNIX-like systems

Michal Privoznik posted 1 patch 1 year, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/6beb31311983867df2314a5d1e1edf3040a36ecb.1664433471.git.mprivozn@redhat.com
tests/virgdbusmock.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] virgdbusmock: Mock g_dbus_connection_call_with_unix_fd_list_sync() only on UNIX-like systems
Posted by Michal Privoznik 1 year, 7 months ago
The g_dbus_connection_call_with_unix_fd_list_sync() function is
not defined always, only when G_OS_UNIX condition is set. This is
also the reason why our virGDBusCallMethodWithFD() function is
guarded with that macro. But virgdbusmock is compiled always,
even on !UNIX systems, e.g. mingw. Therefore, we need to use the
same macro to condition compile its mock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/virgdbusmock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/virgdbusmock.c b/tests/virgdbusmock.c
index 7a378a616a..8f5cc97911 100644
--- a/tests/virgdbusmock.c
+++ b/tests/virgdbusmock.c
@@ -68,6 +68,7 @@ VIR_MOCK_LINK_RET_ARGS(g_dbus_connection_call_sync,
                        GCancellable *, cancellable,
                        GError **, error)
 
+#ifdef G_OS_UNIX
 VIR_MOCK_LINK_RET_ARGS(g_dbus_connection_call_with_unix_fd_list_sync,
                        GVariant *,
                        GDBusConnection *, connection,
@@ -83,3 +84,4 @@ VIR_MOCK_LINK_RET_ARGS(g_dbus_connection_call_with_unix_fd_list_sync,
                        GUnixFDList **, out_fd_list,
                        GCancellable *, cancellable,
                        GError **, error)
+#endif /* G_OS_UNIX */
-- 
2.35.1
Re: [PATCH] virgdbusmock: Mock g_dbus_connection_call_with_unix_fd_list_sync() only on UNIX-like systems
Posted by Ján Tomko 1 year, 7 months ago
On a Thursday in 2022, Michal Privoznik wrote:
>The g_dbus_connection_call_with_unix_fd_list_sync() function is
>not defined always, only when G_OS_UNIX condition is set. This is

As of GLib commit c9874f817be51d3b652457daef3b10766b59db9a, relesed
in GLib 2.73, the g_dbus_connection...

>also the reason why our virGDBusCallMethodWithFD() function is
>guarded with that macro. But virgdbusmock is compiled always,
>even on !UNIX systems, e.g. mingw. Therefore, we need to use the
>same macro to condition compile its mock.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> tests/virgdbusmock.c | 2 ++
> 1 file changed, 2 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano