[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mcel tests: Run the test in several locales
From: |
Bruno Haible |
Subject: |
mcel tests: Run the test in several locales |
Date: |
Tue, 21 May 2024 21:24:51 +0200 |
The CI tests on Solaris 11 show a test failure of test-mcel. The cause is:
1) The program test-mcel is run in a single locale only, namely the locale
of the user. This means that the behaviour in the EUC-JP and GB18030
locales have never been tested.
2) On the CI machine for Solaris 11, LANG is set to C.UTF-8 — but such a
locale does not exist on Solaris 11.
Here I'm fixing the first problem, so as to get a better locale coverage.
The second problem I'll fix in the CI.
2024-05-21 Bruno Haible <bruno@clisp.org>
mcel tests: Run the test in several locales.
* tests/test-mcel-1.sh: New file, based on tests/test-mbrtowc-1.sh.
* tests/test-mcel-2.sh: New file, based on tests/test-mbrtowc-2.sh.
* tests/test-mcel-3.sh: New file, based on tests/test-mbrtowc-3.sh.
* tests/test-mcel-4.sh: New file, based on tests/test-mbrtowc-4.sh.
* tests/test-mcel-5.sh: New file, based on tests/test-mbrtowc-5.sh.
* modules/mcel-tests (Files): Add them. Add tests/macros.h,
m4/locale-fr.m4, m4/locale-ja.m4, m4/locale-zh.m4, m4/codeset.m4.
(Depends-on): Remove assert-h.
(configure.ac, Makefile.am): Essentially copy from
modules/mbrtowc-tests.
diff --git a/modules/mcel-tests b/modules/mcel-tests
index d157608ce3..cc993657d9 100644
--- a/modules/mcel-tests
+++ b/modules/mcel-tests
@@ -1,13 +1,32 @@
Files:
+tests/test-mcel-1.sh
+tests/test-mcel-2.sh
+tests/test-mcel-3.sh
+tests/test-mcel-4.sh
+tests/test-mcel-5.sh
tests/test-mcel.c
+tests/macros.h
+m4/locale-fr.m4
+m4/locale-ja.m4
+m4/locale-zh.m4
+m4/codeset.m4
Depends-on:
-assert-h
setlocale
configure.ac:
+gt_LOCALE_FR
+gt_LOCALE_FR_UTF8
+gt_LOCALE_JA
+gt_LOCALE_ZH_CN
Makefile.am:
-TESTS += test-mcel
+TESTS += \
+ test-mcel-1.sh test-mcel-2.sh test-mcel-3.sh test-mcel-4.sh test-mcel-5.sh
+TESTS_ENVIRONMENT += \
+ LOCALE_FR='@LOCALE_FR@' \
+ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
+ LOCALE_JA='@LOCALE_JA@' \
+ LOCALE_ZH_CN='@LOCALE_ZH_CN@'
check_PROGRAMS += test-mcel
test_mcel_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
$(LIBC32CONV)
diff --git a/tests/test-mcel-1.sh b/tests/test-mcel-1.sh
new file mode 100755
index 0000000000..132824d369
--- /dev/null
+++ b/tests/test-mcel-1.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mcel${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mcel${EXEEXT} 1 || exit 1
+
+exit 0
diff --git a/tests/test-mcel-2.sh b/tests/test-mcel-2.sh
new file mode 100755
index 0000000000..fd85e90a1a
--- /dev/null
+++ b/tests/test-mcel-2.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no traditional french locale is installed"
+ else
+ echo "Skipping test: no traditional french locale is supported"
+ fi
+ exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mcel${EXEEXT} 2
diff --git a/tests/test-mcel-3.sh b/tests/test-mcel-3.sh
new file mode 100755
index 0000000000..a1f21a7a50
--- /dev/null
+++ b/tests/test-mcel-3.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no french Unicode locale is installed"
+ else
+ echo "Skipping test: no french Unicode locale is supported"
+ fi
+ exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mcel${EXEEXT} 3
diff --git a/tests/test-mcel-4.sh b/tests/test-mcel-4.sh
new file mode 100755
index 0000000000..229bb3451e
--- /dev/null
+++ b/tests/test-mcel-4.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no traditional japanese locale is installed"
+ else
+ echo "Skipping test: no traditional japanese locale is supported"
+ fi
+ exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mcel${EXEEXT} 4
diff --git a/tests/test-mcel-5.sh b/tests/test-mcel-5.sh
new file mode 100755
index 0000000000..8e42b993a6
--- /dev/null
+++ b/tests/test-mcel-5.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no transitional chinese locale is installed"
+ else
+ echo "Skipping test: no transitional chinese locale is supported"
+ fi
+ exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mcel${EXEEXT} 5
- mcel tests: Run the test in several locales,
Bruno Haible <=