tests: Skip some of the fileutils tests when running as root

The tests which check permissions and errors like EACCES aren’t going to
work as root, since root always has permission to do things. Skip them
if running as root.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=766390
This commit is contained in:
Philip Withnall 2018-04-12 12:42:48 +01:00
parent 33749d837c
commit c8cbfd551c

View File

@ -880,6 +880,13 @@ test_stdio_wrappers (void)
struct utimbuf ut;
GError *error = NULL;
/* The permissions tests here dont work when running as root. */
if (getuid () == 0 || geteuid () == 0)
{
g_test_skip ("File permissions tests cannot be run as root");
return;
}
g_remove ("mkdir-test/test-create");
ret = g_rmdir ("mkdir-test");
g_assert (ret == 0 || errno == ENOENT);