diff options
author | Simon McVittie <smcv@collabora.com> | 2019-06-29 15:16:03 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2019-07-03 11:11:23 +0100 |
commit | e148aa47d365ef28c524d666e060f3c8b7a9891f (patch) | |
tree | 9afd40373d3e63891ce3b5df2b9aa94ec803f77b | |
parent | 505bbfe4bd2ced20d8637356b431fefded71b2c3 (diff) | |
download | dbus-e148aa47d365ef28c524d666e060f3c8b7a9891f.tar.gz |
tests: Skip if unable to launch uninstalled dbus-daemon as other uid
Some CI systems do the entire build as uid 0 in a throwaway container.
If this is done in a build directory for which the messagebus user
does not have search (+x) permission, then they will be unable to
execute the just-built dbus-daemon binary.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | test/test-utils-glib.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c index 7cc92bc7..cac62e35 100644 --- a/test/test-utils-glib.c +++ b/test/test-utils-glib.c @@ -209,6 +209,24 @@ spawn_dbus_daemon (const gchar *binary, &address_fd, NULL, /* child's stderr = our stderr */ &error); + + /* The other uid might not have access to our build directory if we + * are building in /root or something */ + if (user != TEST_USER_ME && + g_getenv ("DBUS_TEST_UNINSTALLED") != NULL && + error != NULL && + error->domain == G_SPAWN_ERROR && + (error->code == G_SPAWN_ERROR_CHDIR || + error->code == G_SPAWN_ERROR_ACCES || + error->code == G_SPAWN_ERROR_PERM)) + { + g_prefix_error (&error, "Unable to launch %s as other user: ", + binary); + g_test_skip (error->message); + g_clear_error (&error); + return NULL; + } + g_assert_no_error (error); g_ptr_array_free (argv, TRUE); |