summaryrefslogtreecommitdiff
path: root/test/uid-permissions.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-07-06 15:57:18 +0100
committerSimon McVittie <smcv@collabora.com>2017-11-06 16:41:05 +0000
commitf5afec02f20b49ca14300d4075f0dce58988ed42 (patch)
tree153c118f8c2560e3aa29aa41760ecd687ee8c262 /test/uid-permissions.c
parentf58b77f968a66b5a86fcc7697bc6d46cd656fbb7 (diff)
downloaddbus-f5afec02f20b49ca14300d4075f0dce58988ed42.tar.gz
test-utils-glib: Add failable functions to connect to a bus
Instead of calling g_test_skip() internally, raise a distinctive error and let the caller handle it. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
Diffstat (limited to 'test/uid-permissions.c')
-rw-r--r--test/uid-permissions.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/uid-permissions.c b/test/uid-permissions.c
index 19a9aa46..75bbb13f 100644
--- a/test/uid-permissions.c
+++ b/test/uid-permissions.c
@@ -29,6 +29,8 @@
#include "test-utils-glib.h"
+#include <gio/gio.h>
+
typedef struct {
gboolean skip;
@@ -69,12 +71,18 @@ setup (Fixture *f,
return;
}
- f->conn = test_connect_to_bus_as_user (f->ctx, address,
- config ? config->user : TEST_USER_ME);
+ f->conn = test_try_connect_to_bus_as_user (f->ctx, address,
+ config ? config->user : TEST_USER_ME, &f->ge);
- if (f->conn == NULL)
- f->skip = TRUE;
+ if (f->conn == NULL &&
+ g_error_matches (f->ge, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
+ {
+ g_test_skip (f->ge->message);
+ g_clear_error (&f->ge);
+ f->skip = TRUE;
+ }
+ g_assert_no_error (f->ge);
g_free (address);
}