diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-04-12 14:01:40 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-04-12 15:27:34 +0100 |
commit | a769d111600b58452622279128f040f50ebe48f6 (patch) | |
tree | c57f569d9c85fd035d7c8ea9478718e0a7a57f58 | |
parent | 3302343b9dbe8246e1fda0d75db2145d8a9520bd (diff) | |
download | telepathy-glib-a769d111600b58452622279128f040f50ebe48f6.tar.gz |
dbus-tube-chan test: listen on a random address appropriate for the OS
Instead of hard-coding the abstract Unix socket '\000dbus-tube-test',
listen on a random (abstract or real) Unix socket in /tmp if on Unix,
or a random port on 127.0.0.1 if not. These are the same listening
addresses I used in test/loopback.c in libdbus. The Unix version also
matches what the session bus normally uses.
This fixes the test on non-Linux Unix (not insisting on
abstract-namespace sockets working), when run twice in parallel on Linux
(not insisting on using a particular hard-coded name), and in theory
also on Windows (not trying to use Unix sockets).
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48600
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r-- | tests/lib/dbus-tube-chan.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/lib/dbus-tube-chan.c b/tests/lib/dbus-tube-chan.c index 7c615c86e..8af4a1687 100644 --- a/tests/lib/dbus-tube-chan.c +++ b/tests/lib/dbus-tube-chan.c @@ -18,6 +18,12 @@ #include <telepathy-glib/gnio-util.h> #include <glib/gstdio.h> +#if defined(G_OS_UNIX) +# define LISTEN_ADDRESS "unix:tmpdir=/tmp" +#else +# define LISTEN_ADDRESS "tcp:host=127.0.0.1" +#endif + enum { PROP_SERVICE_NAME = 1, @@ -323,8 +329,7 @@ open_tube (TpTestsDBusTubeChannel *self) guid = g_dbus_generate_guid (); - self->priv->dbus_server = g_dbus_server_new_sync ( - "unix:abstract=dbus-tube-test", + self->priv->dbus_server = g_dbus_server_new_sync (LISTEN_ADDRESS, G_DBUS_SERVER_FLAGS_NONE, guid, NULL, NULL, &error); g_assert_no_error (error); |