From: Masatake YAMATO Date: Fri, 19 Jan 2024 22:35:40 +0000 (+0900) Subject: tests: (lsfd::column-xmode) skip some subtests if OFD locks are not available X-Git-Tag: v2.40-rc1~31^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78e50225b46cf6e33b3f203aee4b505d18e86dcc;p=thirdparty%2Futil-linux.git tests: (lsfd::column-xmode) skip some subtests if OFD locks are not available Fixed #2691 partially. Signed-off-by: Masatake YAMATO --- diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c index 2e4ad02b98..9e8e883dbe 100644 --- a/tests/helpers/test_mkfds.c +++ b/tests/helpers/test_mkfds.c @@ -508,6 +508,7 @@ static void lock_fn_posix_rw(int fd, const char *fname, int dupfd) } } +#ifdef F_OFD_SETLK static void lock_fn_ofd_r_(int fd, const char *fname, int dupfd) { struct flock r = { @@ -583,6 +584,7 @@ static void lock_fn_ofd_rw(int fd, const char *fname, int dupfd) err(EXIT_FAILURE, "failed to lock(write)"); } } +#endif /* F_OFD_SETLK */ static void lock_fn_lease_w(int fd, const char *fname, int dupfd) { @@ -647,6 +649,7 @@ static void *make_w_regular_file(const struct factory *factory, struct fdesc fde if (iWrite_bytes < 3) iWrite_bytes = 3; lock_fn = lock_fn_posix_rw; +#ifdef F_OFD_SETLK } else if (strcmp(sLock, "ofd-r-") == 0) { bReadable = true; if (iWrite_bytes < 1) @@ -661,6 +664,12 @@ static void *make_w_regular_file(const struct factory *factory, struct fdesc fde if (iWrite_bytes < 3) iWrite_bytes = 3; lock_fn = lock_fn_ofd_rw; +#else + } else if (strcmp(sLock, "ofd-r-") == 0 + || strcmp(sLock, "ofd--w") == 0 + || strcmp(sLock, "ofd-rw") == 0) { + errx(EXIT_ENOSYS, "no availability for ofd lock"); +#endif /* F_OFD_SETLK */ } else if (strcmp(sLock, "lease-w") == 0) lock_fn = lock_fn_lease_w; else diff --git a/tests/ts/lsfd/column-xmode b/tests/ts/lsfd/column-xmode index dd8539837e..1e719a4a51 100755 --- a/tests/ts/lsfd/column-xmode +++ b/tests/ts/lsfd/column-xmode @@ -19,6 +19,7 @@ TS_DESC="MODE and XMODE columns" . "$TS_TOPDIR"/functions.sh ts_init "$*" +. "$TS_SELF/lsfd-functions.bash" ts_check_test_command "$TS_CMD_LSFD" ts_check_test_command "$TS_HELPER_MKFDS" @@ -142,6 +143,10 @@ for m in flock-sh posix-r- ofd-r-; do fi } > "$TS_OUTPUT" 2>&1 wait "${MKFDS_PID}" + if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then + ts_skip_subtest "$m lock is not available" + continue + fi ts_finalize_subtest done @@ -172,6 +177,10 @@ for m in flock-ex posix--w posix-rw ofd--w ofd-rw lease-w; do fi } > "$TS_OUTPUT" 2>&1 wait "${MKFDS_PID}" + if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then + ts_skip_subtest "$m lock is not available" + continue + fi ts_finalize_subtest done