diff options
author | Simon McVittie <smcv@collabora.com> | 2018-06-04 16:27:49 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2018-06-04 17:56:04 +0100 |
commit | d0837e911d95851e5fc5067ad5b324316ec2666f (patch) | |
tree | d2b100a4ba807b2e28b0c290a2f412a5037ead64 | |
parent | 102129f86a8d0f43e2d8002a46c8a6278e389e46 (diff) | |
download | dbus-d0837e911d95851e5fc5067ad5b324316ec2666f.tar.gz |
test: Test the same things with unix: that we do with tcp:
Minimal autobuilder environments don't always have working TCP,
so we may need to skip TCP tests. Make sure we test the equivalent
code paths via Unix sockets in those environments.
One notable exception is test/fdpass.c, which uses TCP as a transport
that is known not to be able to carry Unix fds; this needs to continue
to use TCP.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106812
(cherry picked from commit cb7dd5bfccb2882d0e9951c41040ff6a97bb827d)
-rw-r--r-- | test/corrupt.c | 5 | ||||
-rw-r--r-- | test/internals/refs.c | 5 | ||||
-rw-r--r-- | test/internals/server-oom.c | 3 | ||||
-rw-r--r-- | test/loopback.c | 7 | ||||
-rw-r--r-- | test/relay.c | 19 |
5 files changed, 32 insertions, 7 deletions
diff --git a/test/corrupt.c b/test/corrupt.c index d6f85021..a2fad64d 100644 --- a/test/corrupt.c +++ b/test/corrupt.c @@ -395,5 +395,10 @@ main (int argc, g_test_add ("/corrupt/byte-order/tcp", Fixture, "tcp:host=127.0.0.1", setup, test_byte_order, teardown); +#ifdef DBUS_UNIX + g_test_add ("/corrupt/byte-order/unix", Fixture, "unix:tmpdir=/tmp", setup, + test_byte_order, teardown); +#endif + return g_test_run (); } diff --git a/test/internals/refs.c b/test/internals/refs.c index b6ad5fe0..72ff8741 100644 --- a/test/internals/refs.c +++ b/test/internals/refs.c @@ -223,7 +223,12 @@ setup (Fixture *f, dbus_error_init (&f->e); +#ifdef DBUS_UNIX + f->server = dbus_server_listen ("unix:tmpdir=/tmp", &f->e); +#else f->server = dbus_server_listen ("tcp:host=127.0.0.1", &f->e); +#endif + assert_no_error (&f->e); g_assert (f->server != NULL); diff --git a/test/internals/server-oom.c b/test/internals/server-oom.c index c8a37f32..e006d9fb 100644 --- a/test/internals/server-oom.c +++ b/test/internals/server-oom.c @@ -124,6 +124,9 @@ main (int argc, add_oom_test ("/server/new-nonce-tcp", test_new_server, "nonce-tcp:host=localhost,bind=localhost"); add_oom_test ("/server/new-tcp-star", test_new_server, "tcp:host=localhost,bind=*"); add_oom_test ("/server/new-tcp-v4", test_new_server, "tcp:host=localhost,bind=localhost,family=ipv4"); +#ifdef DBUS_UNIX + add_oom_test ("/server/unix", test_new_server, "unix:tmpdir=/tmp"); +#endif ret = g_test_run (); diff --git a/test/loopback.c b/test/loopback.c index 59f4a28b..c0bf400f 100644 --- a/test/loopback.c +++ b/test/loopback.c @@ -439,6 +439,9 @@ main (int argc, g_test_add ("/message/nonce-tcp", Fixture, "nonce-tcp:host=127.0.0.1", setup, test_message, teardown); + g_test_add ("/message/bad-guid/tcp", Fixture, "tcp:host=127.0.0.1", setup, + test_bad_guid, teardown); + #ifdef DBUS_UNIX g_test_add ("/connect/unix/tmpdir", Fixture, "unix:tmpdir=/tmp", setup, test_connect, teardown); @@ -455,10 +458,10 @@ main (int argc, g_test_add ("/connect/unix/no-runtime", Fixture, "unix:runtime=yes;unix:tmpdir=/tmp", setup_no_runtime, test_connect, teardown_no_runtime); -#endif - g_test_add ("/message/bad-guid", Fixture, "tcp:host=127.0.0.1", setup, + g_test_add ("/message/bad-guid/unix", Fixture, "unix:tmpdir=/tmp", setup, test_bad_guid, teardown); +#endif return g_test_run (); } diff --git a/test/relay.c b/test/relay.c index 00e7966a..5f905460 100644 --- a/test/relay.c +++ b/test/relay.c @@ -120,7 +120,7 @@ new_conn_cb (DBusServer *server, static void setup (Fixture *f, - gconstpointer data G_GNUC_UNUSED) + gconstpointer address) { test_timeout_reset (1); @@ -128,7 +128,7 @@ setup (Fixture *f, dbus_error_init (&f->e); g_queue_init (&f->messages); - f->server = dbus_server_listen ("tcp:host=127.0.0.1", &f->e); + f->server = dbus_server_listen (address, &f->e); assert_no_error (&f->e); g_assert (f->server != NULL); @@ -321,12 +321,21 @@ main (int argc, { test_init (&argc, &argv); - g_test_add ("/connect", Fixture, NULL, setup, + g_test_add ("/connect/tcp", Fixture, "tcp:host=127.0.0.1", setup, + test_connect, teardown); + g_test_add ("/relay/tcp", Fixture, "tcp:host=127.0.0.1", setup, + test_relay, teardown); + g_test_add ("/limit/tcp", Fixture, "tcp:host=127.0.0.1", setup, + test_limit, teardown); + +#ifdef DBUS_UNIX + g_test_add ("/connect/unix", Fixture, "unix:tmpdir=/tmp", setup, test_connect, teardown); - g_test_add ("/relay", Fixture, NULL, setup, + g_test_add ("/relay/unix", Fixture, "unix:tmpdir=/tmp", setup, test_relay, teardown); - g_test_add ("/limit", Fixture, NULL, setup, + g_test_add ("/limit/unix", Fixture, "unix:tmpdir=/tmp", setup, test_limit, teardown); +#endif return g_test_run (); } |