From: Thomas Weißschuh Date: Tue, 30 May 2023 18:01:49 +0000 (+0200) Subject: test_enosys: fix build on old kernels X-Git-Tag: v2.39.1~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ee8ac0652b7816fae4a455ad81f3838125f9230;p=thirdparty%2Futil-linux.git test_enosys: fix build on old kernels Fixes #2277 Signed-off-by: Thomas Weißschuh --- diff --git a/tests/functions.sh b/tests/functions.sh index bcc2e565b6..c5e42b1a68 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -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: $*" +} diff --git a/tests/helpers/test_enosys.c b/tests/helpers/test_enosys.c index 88e7af3b02..9ee31610f9 100644 --- a/tests/helpers/test_enosys.c +++ b/tests/helpers/test_enosys.c @@ -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) diff --git a/tests/ts/mount/fallback b/tests/ts/mount/fallback index fe932ee78a..c7b8ecfe46 100755 --- a/tests/ts/mount/fallback +++ b/tests/ts/mount/fallback @@ -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"