From: Thomas Weißschuh Date: Sun, 13 Nov 2022 01:38:40 +0000 (+0100) Subject: tests: properly check for widestring functionality X-Git-Tag: v2.39-rc1~425^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c32d33065a2dfd64b6c115ed9256d3aafa3c1ebc;p=thirdparty%2Futil-linux.git tests: properly check for widestring functionality Instead of blindly disabling those test under qemu-user use proper feature-tests. --- diff --git a/tests/functions.sh b/tests/functions.sh index 96915aee68..22bfc24c93 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -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)" } diff --git a/tests/helpers/test_sysinfo.c b/tests/helpers/test_sysinfo.c index aea019276b..f098843819 100644 --- a/tests/helpers/test_sysinfo.c +++ b/tests/helpers/test_sysinfo.c @@ -21,6 +21,7 @@ #include #include #include +#include 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 } }; diff --git a/tests/ts/colcrt/functional b/tests/ts/colcrt/functional index f3c290a5f9..c6d84f1555 100755 --- a/tests/ts/colcrt/functional +++ b/tests/ts/colcrt/functional @@ -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" diff --git a/tests/ts/colcrt/regressions b/tests/ts/colcrt/regressions index c4ccb531cf..975d5a184a 100755 --- a/tests/ts/colcrt/regressions +++ b/tests/ts/colcrt/regressions @@ -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" diff --git a/tests/ts/column/table b/tests/ts/column/table index a9381aac5e..83139f012d 100755 --- a/tests/ts/column/table +++ b/tests/ts/column/table @@ -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"