From: Lennart Poettering Date: Wed, 2 Jun 2021 13:50:16 +0000 (+0200) Subject: test-capability: skip tests that need CAP_NET_RAW if cap is not passed X-Git-Tag: v249-rc1~106^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e80cb4cba4e749a5e849626133de7a97c64e64e4;p=thirdparty%2Fsystemd.git test-capability: skip tests that need CAP_NET_RAW if cap is not passed See: #19746 --- diff --git a/src/test/test-capability.c b/src/test/test-capability.c index 5fa8fe242ef..7a781e57e49 100644 --- a/src/test/test-capability.c +++ b/src/test/test-capability.c @@ -159,9 +159,15 @@ static void test_drop_privileges_fail(void) { } static void test_drop_privileges(void) { + fork_test(test_drop_privileges_fail); + + if (have_effective_cap(CAP_NET_RAW) == 0) /* The remaining two tests only work if we have CAP_NET_RAW + * in the first place. If we are run in some restricted + * container environment we might not. */ + return; + fork_test(test_drop_privileges_keep_net_raw); fork_test(test_drop_privileges_dontkeep_net_raw); - fork_test(test_drop_privileges_fail); } static void test_have_effective_cap(void) {