diff options
author | Simon McVittie <smcv@collabora.com> | 2020-09-15 17:20:59 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2020-09-15 21:54:30 +0100 |
commit | d79cf4b9009a9bae73523f5ac6f9e4154cbb3c6c (patch) | |
tree | 1018835d623ce28c79dee29c906f88af0fc5b0e8 | |
parent | 9bc61def1f815948ea28d92b59f506d3b2024ea0 (diff) | |
download | glib-wip/smcv/reduce-gdbus-server-auth-test.tar.gz |
gdbus-server-auth: Don't usually test non-EXTERNAL repeatedlywip/smcv/reduce-gdbus-server-auth-test
Even after changing the timeouts for #2164, DBUS_COOKIE_SHA1 doesn't
seem to be 100% reliable. EXTERNAL is what we actually hope to be using
on practical Unix systems (notably Linux and several flavours of BSD),
so let's test that thoroughly by default, and just do a relatively
cursory check on DBUS_COOKIE_SHA1 and ANONYMOUS.
In particular, the original purpose of this test was to make sure
that EXTERNAL authentication over AF_UNIX sockets interoperated with
libdbus reliably; it only tests DBUS_COOKIE_SHA1, ANONYMOUS and TCP out
of a sense of completeness.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | gio/tests/gdbus-server-auth.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gio/tests/gdbus-server-auth.c b/gio/tests/gdbus-server-auth.c index b3ee8aab2..b349d5586 100644 --- a/gio/tests/gdbus-server-auth.c +++ b/gio/tests/gdbus-server-auth.c @@ -273,10 +273,23 @@ do_test_server_auth (InteropFlags flags) GVariant *tuple = NULL; gint64 uid, pid; #ifdef HAVE_DBUS1 - /* GNOME/glib#1831 seems to involve a race condition, so try a few times - * to see if we can trigger it. */ gsize i; - gsize n = 20; + gsize n; + + /* GNOME/glib#1831 and GNOME/glib#2164 involve race conditions, so + * try a few times to see if we can trigger them. DBUS_COOKIE_SHA1 + * is still not entirely reliable, so for now we only do this in + * situations where we expect to be able to use EXTERNAL auth, + * unless asked to be particularly thorough. */ + if (g_test_thorough () +#if defined(G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED) || \ + defined(G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED) + || !(flags & (INTEROP_FLAGS_ANONYMOUS | INTEROP_FLAGS_SHA1 | INTEROP_FLAGS_TCP)) +#endif + ) + n = 20; + else + n = 1; #endif if (flags & INTEROP_FLAGS_TCP) |