summaryrefslogtreecommitdiff
path: root/test/relay.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-03-24 15:39:44 +0400
committerSimon McVittie <smcv@collabora.com>2022-07-15 16:26:54 +0100
commit03dac62937639dd4c701a582c26bb3bd35cc8028 (patch)
treee345b211e53658fd48b3d8bbaaa64af363f83f2a /test/relay.c
parent2be8c00a1d3ccf25c7df50c44abd95f120a923d7 (diff)
downloaddbus-03dac62937639dd4c701a582c26bb3bd35cc8028.tar.gz
test/relay: do not hardcode /tmp on !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'test/relay.c')
-rw-r--r--test/relay.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/relay.c b/test/relay.c
index 044260af..77a40849 100644
--- a/test/relay.c
+++ b/test/relay.c
@@ -338,6 +338,12 @@ main (int argc,
char **argv)
{
int ret;
+#ifdef DBUS_UNIX
+ char *tmp = _dbus_strdup ("/tmp");
+#else
+ char *tmp = dbus_address_escape_value (g_get_tmp_dir ());
+#endif
+ gchar *unix_tmpdir = g_strdup_printf ("unix:tmpdir=%s", tmp);
test_init (&argc, &argv);
@@ -349,15 +355,17 @@ main (int argc,
test_limit, teardown);
#ifdef DBUS_UNIX
- g_test_add ("/connect/unix", Fixture, "unix:tmpdir=/tmp", setup,
+ g_test_add ("/connect/unix", Fixture, unix_tmpdir, setup,
test_connect, teardown);
- g_test_add ("/relay/unix", Fixture, "unix:tmpdir=/tmp", setup,
+ g_test_add ("/relay/unix", Fixture, unix_tmpdir, setup,
test_relay, teardown);
- g_test_add ("/limit/unix", Fixture, "unix:tmpdir=/tmp", setup,
+ g_test_add ("/limit/unix", Fixture, unix_tmpdir, setup,
test_limit, teardown);
#endif
ret = g_test_run ();
dbus_shutdown ();
+ g_free (unix_tmpdir);
+ dbus_free (tmp);
return ret;
}