]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: use ts_skip_config where appropriate
authorThomas Weißschuh <thomas@t-8ch.de>
Tue, 19 May 2026 20:52:42 +0000 (22:52 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Wed, 20 May 2026 07:55:17 +0000 (09:55 +0200)
Replace the open-coded implementations with the proper helper.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
tests/ts/libmount/tabfiles
tests/ts/lsns/ioctl_ns
tests/ts/lsns/nsfs
tests/ts/misc/mbsencode
tests/ts/mount/dm-verity

index 30d033917f92e46840e4b94b088c04f5378b4c11..4ac7add1233d2a5280edbce2b74b77e90eee7449 100755 (executable)
@@ -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
 
index 468b02ce999fa461fbc90fdf841012f4d6ad623d..a434747dbc73f9b99add5c283561a41af44f0174 100755 (executable)
@@ -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"
index 39f1c9b328efad7bddbf988eae9dba4a7822a7a0..b67a48f44e9517dea2d0f2365c3706c7dafcf83c 100755 (executable)
@@ -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"
index bd11f2260a61a9243f0e6cde61b505425ee45324..24c87c15014e5fe6524d21be6a76fd3aa92b659f 100755 (executable)
@@ -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
index ae46809da28fd2e64ae627baa58564841b324ded..3f08cee1a6762f81f1dc2058ae9bda484b600dfa 100755 (executable)
@@ -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"