]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: disable mount/subdir on unshared session without new mount API
authorKarel Zak <kzak@redhat.com>
Tue, 2 May 2023 12:59:04 +0000 (14:59 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 2 May 2023 12:59:04 +0000 (14:59 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/helpers/test_sysinfo.c
tests/ts/mount/subdir

index 82227ca3f2589972c397f04a0ed48ccacdbb14af..4d22961c97f050558f2a9f6e2515c2d6be92752b 100644 (file)
@@ -27,6 +27,8 @@
 #include <errno.h>
 #include <sys/ioctl.h>
 
+#include "mount-api-utils.h"
+
 typedef struct {
        const char      *name;
        int             (*fnc)(void);
@@ -110,6 +112,18 @@ static int hlp_enotty_ok(void)
        return 0;
 }
 
+static int hlp_fsopen_ok(void)
+{
+#ifdef FSOPEN_CLOEXEC
+       errno = 0;
+       fsopen(NULL, FSOPEN_CLOEXEC);
+#else
+       errno = ENOSYS;
+#endif
+       printf("%d\n", errno != ENOSYS);
+       return 0;
+}
+
 static mntHlpfnc hlps[] =
 {
        { "WORDSIZE",   hlp_wordsize    },
@@ -123,6 +137,7 @@ static mntHlpfnc hlps[] =
        { "byte-order", hlp_endianness  },
        { "wcsspn-ok",  hlp_wcsspn_ok   },
        { "enotty-ok",  hlp_enotty_ok   },
+       { "fsopen-ok",  hlp_fsopen_ok   },
        { NULL, NULL }
 };
 
index fc1ff2decd5cb04f500d25fab7b8a7aad056d46b..a16a7d0a1f63518926f30ac69d9dad9a34f9d527 100755 (executable)
@@ -26,6 +26,12 @@ ts_check_test_command "$TS_CMD_FINDMNT"
 ts_skip_nonroot
 ts_check_losetup
 
+# unshared session is possible to support only on kernels with new mount API
+if [ "$("$TS_HELPER_SYSINFO" fsopen-ok)" = "0" ]; then
+       prop=$($TS_CMD_FINDMNT --task "$$" -n -o PROPAGATION "/")
+       [[ "$prop" == *"private"* ]] && ts_skip "unsupported session"
+fi
+
 ts_device_init
 DEVICE=$TS_LODEV