static gboolean is_unix = FALSE;
#endif
+static gchar *tmp_address = NULL;
static gchar *test_guid = NULL;
static GMainLoop *service_loop = NULL;
static GDBusServer *server = NULL;
error = NULL;
observer = g_dbus_auth_observer_new ();
- server = g_dbus_server_new_sync (is_unix ? "unix:tmpdir=/tmp/gdbus-test-" : "nonce-tcp:",
+ server = g_dbus_server_new_sync (tmp_address,
G_DBUS_SERVER_FLAGS_NONE,
test_guid,
observer,
error = NULL;
guid = g_dbus_generate_guid ();
- data->server = g_dbus_server_new_sync ("unix:tmpdir=/tmp/gdbus-test-",
+ data->server = g_dbus_server_new_sync (tmp_address,
G_DBUS_SERVER_FLAGS_NONE,
guid,
NULL, /* GDBusAuthObserver */
{
gint ret;
GDBusNodeInfo *introspection_data = NULL;
+ gchar *tmpdir = NULL;
g_type_init ();
g_thread_init (NULL);
test_guid = g_dbus_generate_guid ();
+ if (is_unix)
+ {
+ if (g_unix_socket_address_abstract_names_supported ())
+ tmp_address = g_strdup ("unix:tmpdir=/tmp/gdbus-test-");
+ else
+ {
+ tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL);
+ tmp_address = g_strdup_printf ("unix:tmpdir=%s", tmpdir);
+ }
+ }
+ else
+ tmp_address = g_strdup ("nonce-tcp:");
+
/* all the tests rely on a shared main loop */
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_unref (loop);
g_free (test_guid);
g_dbus_node_info_unref (introspection_data);
+ if (is_unix)
+ g_free (tmp_address);
+ if (tmpdir)
+ {
+ g_rmdir (tmpdir);
+ g_free (tmpdir);
+ }
return ret;
}