Commit 50320cbc authored by Christian Kellner's avatar Christian Kellner

test: skip some (sub)-tests if running as root

In case the test is run as root, certain i/o will be possible
because root has special power. For now just skip those tests.
parent 5ffd01b7
Pipeline #8336 passed with stage
in 5 minutes and 52 seconds
......@@ -733,10 +733,15 @@ test_io_errors (TestIO *tt, gconstpointer user_data)
g_assert_false (ok);
g_clear_pointer (&err, g_error_free);
ok = bolt_write_char_at (dirfd (root), "readonly", 'c', &err);
g_assert_error (err, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED);
g_assert_false (ok);
g_clear_pointer (&err, g_error_free);
if (geteuid () != 0)
{
/* if we run as root, maybe inside a container, we will
* be able o do that anyway so skip it in that case */
ok = bolt_write_char_at (dirfd (root), "readonly", 'c', &err);
g_assert_error (err, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED);
g_assert_false (ok);
g_clear_pointer (&err, g_error_free);
}
/* read_int_at */
ok = bolt_read_int_at (dirfd (root), "NONEXISTENT", &iv, &err);
......@@ -961,6 +966,11 @@ test_fs (TestIO *tt, gconstpointer user_data)
g_assert_no_error (error);
g_assert_true (ok);
if (geteuid () == 0)
/* if we run as root, maybe inside a container, we will
* be able o do that anyway so skip it in that case */
return;
/* check error checking */
r = stat (tt->path, &st);
g_assert_cmpint (r, >, -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment