]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (lsfd::column-xmode) skip some subtests if OFD locks are not available
authorMasatake YAMATO <yamato@redhat.com>
Fri, 19 Jan 2024 22:35:40 +0000 (07:35 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Mon, 22 Jan 2024 12:39:13 +0000 (21:39 +0900)
Fixed #2691 partially.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/helpers/test_mkfds.c
tests/ts/lsfd/column-xmode

index 2e4ad02b98132b8f8d4e4f5e656781ccd66bbefb..9e8e883dbe2fdcc716d7e26452242296e6da7b28 100644 (file)
@@ -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
index dd8539837ee221473f52ff016768f3f7681d0bdf..1e719a4a51060297c83a7e1ccfc2f6a46bd63659 100755 (executable)
@@ -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