From: Karel Zak Date: Tue, 2 May 2023 12:59:04 +0000 (+0200) Subject: tests: disable mount/subdir on unshared session without new mount API X-Git-Tag: v2.39~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=501b59962451845cb4ff86b0477ddf4d37553d5b;p=thirdparty%2Futil-linux.git tests: disable mount/subdir on unshared session without new mount API Signed-off-by: Karel Zak --- diff --git a/tests/helpers/test_sysinfo.c b/tests/helpers/test_sysinfo.c index 82227ca3f2..4d22961c97 100644 --- a/tests/helpers/test_sysinfo.c +++ b/tests/helpers/test_sysinfo.c @@ -27,6 +27,8 @@ #include #include +#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 } }; diff --git a/tests/ts/mount/subdir b/tests/ts/mount/subdir index fc1ff2decd..a16a7d0a1f 100755 --- a/tests/ts/mount/subdir +++ b/tests/ts/mount/subdir @@ -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