summaryrefslogtreecommitdiffstats
path: root/tests/ts
diff options
context:
space:
mode:
authorVaclav Dolezal2018-01-11 11:11:31 +0100
committerVaclav Dolezal2018-01-11 11:11:31 +0100
commit8326119ad1976c42275af848688e57f0100ffa82 (patch)
tree26d54ac77d55b0e7caf1255cbef67218b59b7588 /tests/ts
parentlib/mbsalign: Fix escaping nonprintable multibyte characters (diff)
downloadkernel-qcow2-util-linux-8326119ad1976c42275af848688e57f0100ffa82.tar.gz
kernel-qcow2-util-linux-8326119ad1976c42275af848688e57f0100ffa82.tar.xz
kernel-qcow2-util-linux-8326119ad1976c42275af848688e57f0100ffa82.zip
tests: mbsencode - test for HAVE_WIDECHAR
Test only safe-ascii as it should behave in the same way. Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Diffstat (limited to 'tests/ts')
-rwxr-xr-xtests/ts/misc/mbsencode34
1 files changed, 26 insertions, 8 deletions
diff --git a/tests/ts/misc/mbsencode b/tests/ts/misc/mbsencode
index 8ebf73f46..b483a53d1 100755
--- a/tests/ts/misc/mbsencode
+++ b/tests/ts/misc/mbsencode
@@ -40,23 +40,41 @@ STRINGS=(
$'\xe8\xe1\xf9\xa7'
)
+if grep -q '^#define HAVE_WIDECHAR' ${top_builddir}/config.h ;then
+ HAVE_WIDECHAR=true
+else
+ HAVE_WIDECHAR=false
+fi
+
ts_init_subtest "safe-ascii"
$TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
ts_finalize_subtest
ts_init_subtest "invalid-ascii"
-$TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
-ts_finalize_subtest
+if [ "$HAVE_WIDECHAR" = true ]; then
+ $TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
+ ts_finalize_subtest
+else
+ ts_skip_subtest 'No widechar support'
+fi
ts_init_subtest "safe-utf8"
-LC_ALL=C.UTF-8 \
-$TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
-ts_finalize_subtest
+if [ "$HAVE_WIDECHAR" = true ]; then
+ LC_ALL=C.UTF-8 \
+ $TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
+ ts_finalize_subtest
+else
+ ts_skip_subtest 'No widechar support'
+fi
ts_init_subtest "invalid-utf8"
-LC_ALL=C.UTF-8 \
-$TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
-ts_finalize_subtest
+if [ "$HAVE_WIDECHAR" = true ]; then
+ LC_ALL=C.UTF-8 \
+ $TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
+ ts_finalize_subtest
+else
+ ts_skip_subtest 'No widechar support'
+fi
ts_finalize