summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-09-15 18:04:36 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-11-06 14:29:43 +0000
commitfc2fa25a3f729a704ff4ae8e3c733b81eb7c0c75 (patch)
tree6ea8ac532c46bd8d14eebe792cc113aeb844736f
parentaebc2474023f5fc37d3bbffd686da155018325bd (diff)
downloaddbus-fc2fa25a3f729a704ff4ae8e3c733b81eb7c0c75.tar.gz
dbus-daemon test: don't assert we pass uid/pid on unknown Unix platforms
We know that Linux, FreeBSD and OpenBSD are "first class citizens" for credentials-passing, with NetBSD not far behind: people have turned up on the bug tracking system and told us that tests passed. On other Unixes, we can't really assert that it works, until someone who runs them tells us that it worked for them. Additions to these lists are welcome. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702 Reviewed-by: Patrick Welche <prlw1@cam.ac.uk> Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk> Tested-by: Patrick Welche <prlw1@cam.ac.uk>
-rw-r--r--test/dbus-daemon.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c
index 1db4e44b..43f3445c 100644
--- a/test/dbus-daemon.c
+++ b/test/dbus-daemon.c
@@ -43,6 +43,30 @@
#include "test-utils.h"
+/* Platforms where we know that credentials-passing passes both the
+ * uid and the pid. Please keep these in alphabetical order.
+ *
+ * These platforms should #error in _dbus_read_credentials_socket()
+ * if we didn't detect their flavour of credentials-passing, since that
+ * would be a regression.
+ */
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+ defined(__linux__) || \
+ defined(__OpenBSD__)
+# define UNIX_USER_SHOULD_WORK
+# define PID_SHOULD_WORK
+#endif
+
+/* Platforms where we know that credentials-passing passes the
+ * uid, but not necessarily the pid. Again, alphabetical order please.
+ *
+ * These platforms should also #error in _dbus_read_credentials_socket()
+ * if we didn't detect their flavour of credentials-passing.
+ */
+#if defined(__NetBSD__)
+# define UNIX_USER_SHOULD_WORK
+#endif
+
typedef struct {
gboolean skip;
@@ -528,8 +552,11 @@ test_creds (Fixture *f,
dbus_message_iter_next (&arr_iter);
}
-#ifdef G_OS_UNIX
+#ifdef UNIX_USER_SHOULD_WORK
g_assert (seen & SEEN_UNIX_USER);
+#endif
+
+#ifdef PID_SHOULD_WORK
g_assert (seen & SEEN_PID);
#endif