1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00
libvirt/tests/virgdbusmock.c
Michal Privoznik b1fc788957 virgdbusmock: Mock g_dbus_connection_call_with_unix_fd_list_sync() only on UNIX-like systems
As of GLib commit c9874f817be51d3b652457daef3b10766b59db9a,
relesed in GLib 2.73, 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>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-30 15:38:47 +02:00

88 lines
3.5 KiB
C

/*
* virgdbusmock.c: mocking of dbus message send/reply
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <gio/gio.h>
#include "virmock.h"
VIR_MOCK_STUB_RET_ARGS(g_bus_get_sync,
GDBusConnection *, (GDBusConnection *)0x1,
GBusType, type,
GCancellable, *cancellable,
GError, **error)
VIR_MOCK_STUB_RET_ARGS(g_dbus_address_get_for_bus_sync,
gchar *, (gchar *)0x1,
GBusType, type,
GCancellable *, cancellable,
GError **, error)
VIR_MOCK_STUB_RET_ARGS(g_dbus_connection_new_for_address_sync,
GDBusConnection *, (GDBusConnection *)0x1,
const gchar *, address,
GDBusConnectionFlags, flags,
GDBusAuthObserver *, observer,
GCancellable *, cancellable,
GError **, error)
VIR_MOCK_STUB_RET_ARGS(g_dbus_connection_flush_sync,
gboolean, true,
GDBusConnection *, connection,
GCancellable *, cancellable,
GError **, error)
VIR_MOCK_STUB_RET_ARGS(g_dbus_connection_close_sync,
gboolean, true,
GDBusConnection *, connection,
GCancellable *, cancellable,
GError **, error)
VIR_MOCK_LINK_RET_ARGS(g_dbus_connection_call_sync,
GVariant *,
GDBusConnection *, connection,
const gchar *, bus_name,
const gchar *, object_path,
const gchar *, interface_name,
const gchar *, method_name,
GVariant *, parameters,
const GVariantType *, reply_type,
GDBusCallFlags, flags,
gint, timeout_msec,
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,
const gchar *, bus_name,
const gchar *, object_path,
const gchar *, interface_name,
const gchar *, method_name,
GVariant *, parameters,
const GVariantType *, reply_type,
GDBusCallFlags, flags,
gint, timeout_msec,
GUnixFDList *, fd_list,
GUnixFDList **, out_fd_list,
GCancellable *, cancellable,
GError **, error)
#endif /* G_OS_UNIX */