]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: properly check for widestring functionality
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 13 Nov 2022 01:38:40 +0000 (02:38 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 13 Nov 2022 01:38:40 +0000 (02:38 +0100)
Instead of blindly disabling those test under qemu-user use proper
feature-tests.

tests/functions.sh
tests/helpers/test_sysinfo.c
tests/ts/colcrt/functional
tests/ts/colcrt/regressions
tests/ts/column/table

index 96915aee68a3010d7d943e19dbc62b29fbb3ec3a..22bfc24c9368719f3cd8630e17edc1a32a969232 100644 (file)
@@ -117,6 +117,15 @@ function ts_check_losetup {
        ts_skip "no loop-device support"
 }
 
+function ts_check_wcsspn {
+       # https://gitlab.com/qemu-project/qemu/-/issues/1248
+       if [ -e "$TS_HELPER_SYSINFO" ] &&
+               [ "$("$TS_HELPER_SYSINFO" wcsspn-ok)" = "0" ]; then
+
+               ts_skip "non-functional widestring functions"
+       fi
+}
+
 function ts_report_skip {
        ts_report " SKIPPED ($1)"
 }
index aea019276b7312b1d42e1a2636e7a9fe55af7542..f09884381940071e12d2bb6673112fa4aef8c046 100644 (file)
@@ -21,6 +21,7 @@
 #include <limits.h>
 #include <stdint.h>
 #include <inttypes.h>
+#include <wchar.h>
 
 typedef struct {
        const char      *name;
@@ -90,6 +91,12 @@ static int hlp_ulong_max32(void)
        return 0;
 }
 
+static int hlp_wcsspn_ok(void)
+{
+       printf("%d\n", wcsspn(L"FOO", L"F") == 1);
+       return 0;
+}
+
 static mntHlpfnc hlps[] =
 {
        { "WORDSIZE",   hlp_wordsize    },
@@ -101,6 +108,7 @@ static mntHlpfnc hlps[] =
        { "ULONG_MAX32",hlp_ulong_max32 },
        { "UINT64_MAX", hlp_u64_max     },
        { "byte-order", hlp_endianness  },
+       { "wcsspn-ok",  hlp_wcsspn_ok   },
        { NULL, NULL }
 };
 
index f3c290a5f9239193117531f9811c4f201a740413..c6d84f15554299966e956578ab0708e02e221927 100755 (executable)
@@ -19,8 +19,8 @@ TS_DESC="functional"
 export LC_CTYPE='C'
 
 . $TS_TOPDIR/functions.sh
-ts_skip_qemu_user # https://gitlab.com/qemu-project/qemu/-/issues/1248
 ts_init "$*"
+ts_check_wcsspn
 
 ts_check_test_command "$TS_CMD_COLCRT"
 
index c4ccb531cfeae63b81086f19525b585c364a82a8..975d5a184a23ca227d6b634166519639f2583170 100755 (executable)
@@ -17,8 +17,8 @@ TS_TOPDIR="${0%/*}/../.."
 TS_DESC="regressions"
 
 . $TS_TOPDIR/functions.sh
-ts_skip_qemu_user # https://gitlab.com/qemu-project/qemu/-/issues/1248
 ts_init "$*"
+ts_check_wcsspn
 
 ts_check_test_command "$TS_CMD_COLCRT"
 ts_check_prog "timeout"
index a9381aac5eaaf4dfb9132997723a8fefd2a664cb..83139f012d23f24c976f83806b8d847f47b347d1 100755 (executable)
@@ -19,8 +19,8 @@ TS_TOPDIR="${0%/*}/../.."
 TS_DESC="table"
 
 . $TS_TOPDIR/functions.sh
-ts_skip_qemu_user # https://gitlab.com/qemu-project/qemu/-/issues/1248
 ts_init "$*"
+ts_check_wcsspn
 
 ts_check_test_command "$TS_CMD_COLUMN"
 ts_cd "$TS_OUTDIR"