From: Thomas Weißschuh Date: Tue, 19 May 2026 20:52:42 +0000 (+0200) Subject: tests: use ts_skip_config where appropriate X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=726b38c5f955f2f92ff650e5999fbe4e931b9637;p=thirdparty%2Futil-linux.git tests: use ts_skip_config where appropriate Replace the open-coded implementations with the proper helper. Signed-off-by: Thomas Weißschuh --- diff --git a/tests/ts/libmount/tabfiles b/tests/ts/libmount/tabfiles index 30d033917..4ac7add12 100755 --- a/tests/ts/libmount/tabfiles +++ b/tests/ts/libmount/tabfiles @@ -83,7 +83,7 @@ sed -i -e 's/fs: 0x.*/fs:/g' "$TS_OUTPUT" ts_finalize_subtest ts_init_subtest "is-mounted-btrfs" -grep -q '#define HAVE_BTRFS_SUPPORT' ${top_builddir}/config.h || ts_skip "no btrfs support" +ts_skip_config HAVE_BTRFS_SUPPORT "no btrfs support" ts_run $TESTPROG --is-mounted "$TS_SELF/files/fstab_btrfs" "$TS_SELF/files/mountinfo_btrfs" &> "$TS_OUTPUT" ts_finalize_subtest diff --git a/tests/ts/lsns/ioctl_ns b/tests/ts/lsns/ioctl_ns index 468b02ce9..a434747db 100755 --- a/tests/ts/lsns/ioctl_ns +++ b/tests/ts/lsns/ioctl_ns @@ -22,7 +22,7 @@ TS_DESC="ownership and hierarchy" ts_init "$*" # ts_skip_nonroot -grep -q '#define HAVE_LINUX_NSFS_H' ${top_builddir}/config.h || ts_skip "no ioctl_ns support" +ts_skip_config HAVE_LINUX_NSFS_H "no ioctl_ns support" [ -r /proc/self/ns/user ] || ts_skip "no USER namespace kernel support" [ -r /proc/self/ns/pid ] || ts_skip "no PID namespace kernel support" diff --git a/tests/ts/lsns/nsfs b/tests/ts/lsns/nsfs index 39f1c9b32..b67a48f44 100755 --- a/tests/ts/lsns/nsfs +++ b/tests/ts/lsns/nsfs @@ -34,7 +34,7 @@ ts_check_prog "touch" ts_check_prog "mkfifo" ts_check_prog "sed" -grep -q '#define HAVE_LINUX_NET_NAMESPACE_H' ${top_builddir}/config.h || ts_skip "no netns support" +ts_skip_config HAVE_LINUX_NET_NAMESPACE_H "no netns support" if [ "$($TS_HELPER_SYSINFO ns-gettype-ok)" == "0" ]; then ts_skip "NS_GET_NSTYPE ioctl cmd not available" diff --git a/tests/ts/misc/mbsencode b/tests/ts/misc/mbsencode index bd11f2260..24c87c150 100755 --- a/tests/ts/misc/mbsencode +++ b/tests/ts/misc/mbsencode @@ -56,29 +56,20 @@ $TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" ts_finalize_subtest ts_init_subtest "invalid-ascii" -if [ "$HAVE_WIDECHAR" = true ]; then - $TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" -else - ts_skip 'No widechar support' -fi +ts_skip_config HAVE_WIDECHAR 'No widechar support' +$TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" ts_finalize_subtest ts_init_subtest "safe-utf8" -if [ "$HAVE_WIDECHAR" = true ]; then - LC_ALL=C.UTF-8 \ - $TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" -else - ts_skip 'No widechar support' -fi +ts_skip_config HAVE_WIDECHAR 'No widechar support' +LC_ALL=C.UTF-8 \ +$TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" ts_finalize_subtest ts_init_subtest "invalid-utf8" -if [ "$HAVE_WIDECHAR" = true ]; then - LC_ALL=C.UTF-8 \ - $TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" -else - ts_skip 'No widechar support' -fi +ts_skip_config HAVE_WIDECHAR 'No widechar support' +LC_ALL=C.UTF-8 \ +$TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" ts_finalize_subtest ts_finalize diff --git a/tests/ts/mount/dm-verity b/tests/ts/mount/dm-verity index ae46809da..3f08cee1a 100755 --- a/tests/ts/mount/dm-verity +++ b/tests/ts/mount/dm-verity @@ -35,7 +35,7 @@ ts_skip_nonroot ts_check_prog "mksquashfs" ts_check_prog "veritysetup" -grep -q '#define HAVE_CRYPTSETUP' ${top_builddir}/config.h || ts_skip "no dm-verity support" +ts_skip_config HAVE_CRYPTSETUP "no dm-verity support" # Make a squashfs and prepare verity device out of it mksquashfs $TS_SELF $SQUASHFS &>/dev/null || ts_skip "error: mksquashfs on $TS_SELF"