]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Skip protect_kernel_logs test if libmount is missing
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 24 Nov 2025 15:08:57 +0000 (16:08 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 24 Nov 2025 15:10:31 +0000 (16:10 +0100)
libmount is required for setup_namespace() so skip the test if it
is not available.

src/test/test-namespace.c

index 03b0bdf4abf2bc68dfdd4e0d92e0cdcfcd9f5065..f162075c7c44a758cd50657630dc8091619fbbf5 100644 (file)
@@ -14,6 +14,7 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "libmount-util.h"
 #include "namespace-util.h"
 #include "namespace.h"
 #include "pidref.h"
@@ -203,6 +204,7 @@ TEST(protect_kernel_logs) {
                 .root_directory_fd = -EBADF,
         };
         pid_t pid;
+        int r;
 
         if (geteuid() > 0) {
                 (void) log_tests_skipped("not root");
@@ -215,6 +217,13 @@ TEST(protect_kernel_logs) {
                 return;
         }
 
+        r = dlopen_libmount();
+        if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) {
+                (void) log_tests_skipped("libmount support not compiled in");
+                return;
+        }
+        ASSERT_OK(r);
+
         pid = fork();
         ASSERT_OK_ERRNO(pid);