From d7bb4664e7f61a53657f851220aec818c0fb5fbb Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 27 Sep 2024 17:06:47 +0100 Subject: [PATCH] tests: Add a way to get the mock session bus address in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is better than using `g_getenv ("DBUS_SESSION_BUS_ADDRESS")` as it will fail more explicitly if the mock bus somehow isn’t running. This will be used in an upcoming commit. Signed-off-by: Philip Withnall --- gio/tests/gdbus-sessionbus.c | 7 +++++++ gio/tests/gdbus-sessionbus.h | 1 + 2 files changed, 8 insertions(+) diff --git a/gio/tests/gdbus-sessionbus.c b/gio/tests/gdbus-sessionbus.c index 09d163969..f4dbb4ff9 100644 --- a/gio/tests/gdbus-sessionbus.c +++ b/gio/tests/gdbus-sessionbus.c @@ -71,3 +71,10 @@ session_bus_run (void) return ret; } + +const char * +session_bus_get_address (void) +{ + g_assert (singleton != NULL); + return g_test_dbus_get_bus_address (singleton); +} diff --git a/gio/tests/gdbus-sessionbus.h b/gio/tests/gdbus-sessionbus.h index bd6f2a2ad..9fa80336f 100644 --- a/gio/tests/gdbus-sessionbus.h +++ b/gio/tests/gdbus-sessionbus.h @@ -31,6 +31,7 @@ void session_bus_up (void); void session_bus_stop (void); void session_bus_down (void); gint session_bus_run (void); +const char *session_bus_get_address (void); G_END_DECLS