From bce38ba0d6ad45e7baa1cd2d58bd8e7ab42b82f6 Mon Sep 17 00:00:00 2001 From: Ali Abdallah Date: Fri, 15 May 2020 19:15:08 +0200 Subject: Use a custom test-driver Implement a custom test driver that will start the freshly compiled xfconfd on a different dbus name. When the test finishes, gets interrupted or exists with error, the xfconfd test instance is terminated. This will allows 'make check' and 'make distcheck' to be successful even if xfconfd is not installed or running. --- xfconf/xfconf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'xfconf') diff --git a/xfconf/xfconf.c b/xfconf/xfconf.c index 228bdc3..748a55f 100644 --- a/xfconf/xfconf.c +++ b/xfconf/xfconf.c @@ -41,6 +41,9 @@ static GDBusConnection *gdbus = NULL; static GDBusProxy *gproxy = NULL; static GHashTable *named_structs = NULL; +#define XFCONF_DBUS_NAME "org.xfce.Xfconf" +#define XFCONF_DBUS_NAME_TEST "org.xfce.XfconfTest" + /* private api */ @@ -108,6 +111,8 @@ _xfconf_named_struct_free(XfconfNamedStruct *ns) gboolean xfconf_init(GError **error) { + const gchar *is_test_mode; + if(xfconf_refcnt) { ++xfconf_refcnt; return TRUE; @@ -122,10 +127,11 @@ xfconf_init(GError **error) if (!gdbus) return FALSE; + is_test_mode = g_getenv ("XFCONF_RUN_IN_TEST_MODE"); gproxy = g_dbus_proxy_new_sync(gdbus, G_DBUS_PROXY_FLAGS_NONE, NULL, - "org.xfce.Xfconf", + is_test_mode == NULL ? XFCONF_DBUS_NAME : XFCONF_DBUS_NAME_TEST, "/org/xfce/Xfconf", "org.xfce.Xfconf", NULL, -- cgit v1.2.1