summaryrefslogtreecommitdiff
path: root/xfconf
diff options
context:
space:
mode:
authorAli Abdallah <ali.abdallah@suse.com>2020-05-15 19:15:08 +0200
committerAli Abdallah <ali.abdallah@suse.com>2020-05-17 19:30:59 +0200
commitbce38ba0d6ad45e7baa1cd2d58bd8e7ab42b82f6 (patch)
tree5c56450e0b9d4d504cb75647150bb5554c906859 /xfconf
parent6e4e3704f262e35c396ffa610538244b63115c29 (diff)
downloadxfconf-bce38ba0d6ad45e7baa1cd2d58bd8e7ab42b82f6.tar.gz
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.
Diffstat (limited to 'xfconf')
-rw-r--r--xfconf/xfconf.c8
1 files changed, 7 insertions, 1 deletions
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,