]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
test_enosys: fix build on old kernels
authorThomas Weißschuh <thomas@t-8ch.de>
Tue, 30 May 2023 18:01:49 +0000 (20:01 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 31 May 2023 07:32:50 +0000 (09:32 +0200)
Fixes #2277

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
tests/functions.sh
tests/helpers/test_enosys.c
tests/ts/mount/fallback

index bcc2e565b68b2245841125c0622496a21ae6e9de..c5e42b1a68a2e1baf8646b6bfe321c570c30ee0b 100644 (file)
@@ -1157,3 +1157,9 @@ function ts_is_virt {
        done
        return 1
 }
+
+function ts_check_enosys_syscalls {
+       ts_check_test_command "$TS_HELPER_ENOSYS"
+       "$TS_HELPER_ENOSYS" ${@/#/-s } true 2> /dev/null
+       [ $? -ne 0 ] && ts_skip "test_enosys does not work: $*"
+}
index 88e7af3b02feef8388d22ceedc477e33ab6184f0..9ee31610f9ee1b9cec1a40fdf4beedb8ee74161e 100644 (file)
@@ -65,9 +65,15 @@ struct syscall {
 };
 
 const struct syscall syscalls[] = {
+#ifdef __NR_move_mount
        { "move_mount", __NR_move_mount },
+#endif
+#ifdef __NR_open_tree
        { "open_tree", __NR_open_tree },
+#endif
+#ifdef __NR_fsopen
        { "fsopen", __NR_fsopen },
+#endif
 };
 
 int main(int argc, char **argv)
index fe932ee78a62a4710b120f168951c1db7d536f28..c7b8ecfe46187987b5d5d986ac84b61918b88b95 100755 (executable)
@@ -6,15 +6,13 @@ TS_DESC="fstab-fallback"
 . "$TS_TOPDIR"/functions.sh
 ts_init "$*"
 
-ts_check_test_command "$TS_HELPER_ENOSYS"
 ts_check_test_command "$TS_CMD_MOUNT"
 ts_check_test_command "$TS_CMD_UMOUNT"
 ts_check_test_command "$TS_CMD_FINDMNT"
 ts_check_test_command "$TS_CMD_LOSETUP"
+ts_check_enosys_syscalls open_tree fsopen
 
 ts_skip_nonroot
-"$TS_HELPER_ENOSYS" true 2> /dev/null
-[ "$?" -eq "$TS_EXIT_NOTSUPP" ] && ts_skip "test_enosys does not work"
 
 test_mount_fallback() {
        ts_init_subtest "$1"