1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-11 20:58:27 +03:00

test-fd-util: skip test when lacking privileges to create a new namespace

To reproduce, as an unprivileged user start a docker container and build
and run the unit tests inside it:

$ docker run --rm -ti debian:bookworm bash
...
/* test_close_all_fds */
Successfully forked off '(caf-plain)' as PID 10496.
Skipping PR_SET_MM, as we don't have privileges.
(caf-plain) succeeded.
Failed to fork off '(caf-noproc)': Operation not permitted
Assertion 'r >= 0' failed at src/test/test-fd-util.c:392, function test_close_all_fds(). Aborting.

Partially fixes #35552
This commit is contained in:
Luca Boccassi 2024-12-11 12:01:18 +00:00
parent 058a07635f
commit 630a2e7ee1

View File

@ -389,6 +389,8 @@ TEST(close_all_fds) {
test_close_all_fds_inner();
_exit(EXIT_SUCCESS);
}
if (ERRNO_IS_NEG_PRIVILEGE(r))
return (void) log_tests_skipped("Lacking privileges for test in namespace with /proc/ overmounted");
assert_se(r >= 0);
if (!is_seccomp_available())