[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Make internationalization tests stricter on musl systems
From: |
Bruno Haible |
Subject: |
Make internationalization tests stricter on musl systems |
Date: |
Wed, 14 Jun 2023 01:41:35 +0200 |
Many i18n tests in gnulib and gettext are not really exercised, because so far
all m4/locale-*.m4 tests report that there is no usable French / Turkish / etc.
locale on a musl system. This is correct when one looks at all locale categories
together and expects e.g. in the French UTF-8 locale a French decimal separator,
French month names, a French currency and so on. But in musl libc, only the
LC_CTYPE category is reasonably implemented, not the other locale categories.
Citing Rich Felker in <https://www.openwall.com/lists/musl/2017/11/08/1>:
"The choice I made at the time to avoid this was to declare that all
locale names are valid locales, and if there's no actual file defining
the locale, it's simply a clone of C.UTF-8. So for example if you run
with LC_ALL=fr_FR but no fr_FR translation file, you get a locale
named fr_FR (that's what setlocale reports as the active locale) but
with no translated messages/dates/etc., just UTF-8 character encoding
(so you're still able to access all characters properly and use
localized or multilingual data)."
With this patch, gnulib sets LOCALE_FR_UTF8 to "fr_FR.UTF-8" instead of "none"
and thus enables the tests of some i18n functions, such as mbrtowc and wcrtomb.
Doing the same thing with the LOCALE_TR_UTF8 variable is not appropriate,
because our tests of the Turkish locale test the 'i'/'I' behaviour
in particular, which is not implemented in musl libc; thus these tests would
fail.
2023-06-13 Bruno Haible <bruno@clisp.org>
Make internationalization tests stricter on musl systems.
--
* m4/locale-fr.m4 (gt_LOCALE_FR): On musl systems, set LOCALE_FR_UTF8 to
"fr_FR.UTF-8" instead of "none". Set and substitute
LC_COLLATE_IMPLEMENTED, LC_NUMERIC_IMPLEMENTED, LC_TIME_IMPLEMENTED,
LC_MONETARY_IMPLEMENTED.
* m4/iswdigit.m4 (gl_FUNC_ISWDIGIT): Skip testing a certain locale if
that locale is "none".
* m4/iswxdigit.m4 (gl_FUNC_ISWXDIGIT): Likewise.
* m4/mbrlen.m4 (gl_MBRLEN_RETVAL): Likewise.
* m4/mbrtowc.m4 (gl_MBRTOWC_RETVAL): Likewise.
* m4/mbrtoc32.m4 (gl_MBRTOC32_SANITYCHECK): Likewise.
* m4/mbsrtowcs.m4 (gl_MBSRTOWCS_WORKS): Likewise.
* m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Likewise.
--
* tests/test-c32isalpha.c (main): On musl libc, disable tests that fail.
* tests/test-c32iscntrl.c (main): Likewise.
* tests/test-c32isgraph.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32isprint.c (main): Likewise.
* tests/test-c32toupper.c (main): Likewise.
* tests/test-nl_langinfo1.c (main): Likewise.
* tests/test-nl_langinfo2.c (main): Likewise.
* modules/c32isalpha-tests (Files): Add musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.
* modules/c32iscntrl-tests (Files): Add musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.
* modules/c32isgraph-tests (Files): Add musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.
* modules/c32islower-tests (Files): Add musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.
* modules/c32isprint-tests (Files): Add musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.
* modules/c32toupper-tests (Files): Add musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.
* modules/nl_langinfo-tests (Files): Add musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.
--
* tests/test-strtod1.sh: Skip the test if LC_NUMERIC_IMPLEMENTED is
false.
* tests/test-strtold1.sh: Likewise.
* tests/test-vasnprintf-posix2.sh: Likewise.
* tests/test-vasnwprintf-posix2.sh: Likewise.
* modules/strtod-tests (Makefile.am): Set LC_NUMERIC_IMPLEMENTED in the
tests environment.
* modules/strtold-tests (Makefile.am): Likewise.
* modules/vasnprintf-posix-tests (Makefile.am): Likewise.
* modules/vasnwprintf-posix-tests (Makefile.am): Likewise.
diff --git a/m4/iswdigit.m4 b/m4/iswdigit.m4
index 0df7b303fc..54a2943ead 100644
--- a/m4/iswdigit.m4
+++ b/m4/iswdigit.m4
@@ -1,4 +1,4 @@
-# iswdigit.m4 serial 3
+# iswdigit.m4 serial 4
dnl Copyright (C) 2020-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -63,7 +63,8 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
int is;
int result = 0;
- if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+ if (strcmp ("$LOCALE_FR", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
{
/* This fails on mingw, MSVC 14. */
/* U+00B2 SUPERSCRIPT TWO */
@@ -71,7 +72,8 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
if (!(is == 0))
result |= 1;
}
- if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+ if (strcmp ("$LOCALE_JA", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
{
/* This fails on NetBSD 8.0. */
/* U+FF11 FULLWIDTH DIGIT ONE */
@@ -79,7 +81,8 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
if (!(is == 0))
result |= 2;
}
- if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+ if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{
/* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */
/* U+0663 ARABIC-INDIC DIGIT THREE */
@@ -92,7 +95,8 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
if (!(is == 0))
result |= 8;
}
- if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+ if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
{
/* This fails on NetBSD 8.0, Solaris 10, Solaris 11.4. */
/* U+FF11 FULLWIDTH DIGIT ONE */
diff --git a/m4/iswxdigit.m4 b/m4/iswxdigit.m4
index 3f952f0b0d..a16b10aed3 100644
--- a/m4/iswxdigit.m4
+++ b/m4/iswxdigit.m4
@@ -1,4 +1,4 @@
-# iswxdigit.m4 serial 3
+# iswxdigit.m4 serial 4
dnl Copyright (C) 2020-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -62,7 +62,8 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT]
int is;
int result = 0;
- if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+ if (strcmp ("$LOCALE_JA", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
{
/* This fails on NetBSD 8.0. */
/* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
@@ -70,7 +71,8 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT]
if (!(is == 0))
result |= 1;
}
- if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+ if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{
/* This fails on FreeBSD 13.0. */
/* U+0663 ARABIC-INDIC DIGIT THREE */
@@ -83,7 +85,8 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT]
if (!(is == 0))
result |= 4;
}
- if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+ if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
{
/* This fails on Solaris 10, Solaris 11.4. */
/* U+FF11 FULLWIDTH DIGIT ONE */
diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4
index 5e13f3945d..107ab931e8 100644
--- a/m4/locale-fr.m4
+++ b/m4/locale-fr.m4
@@ -139,9 +139,19 @@ AC_DEFUN_ONCE([gt_LOCALE_FR]
dnl Determine the name of a french locale with UTF-8 encoding.
AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8],
[
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AM_LANGINFO_CODESET])
AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [
- AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+ case "$host_os" in
+ *-musl* | midipix*)
+ dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without
+ dnl any locale file on disk. But they are effectively equivalent to the
+ dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES)
+ dnl for which localizations (.mo files) have been installed.
+ gt_cv_locale_fr_utf8=fr_FR.UTF-8
+ ;;
+ *)
+ AC_LANG_CONFTEST([AC_LANG_SOURCE([[
#include <locale.h>
#include <time.h>
#if HAVE_LANGINFO_CODESET
@@ -203,51 +213,76 @@ AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8]
#endif
return 0;
}
- ]])])
- if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
- case "$host_os" in
- # Handle native Windows specially, because there setlocale() interprets
- # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
- # "fr" or "fra" as "French" or "French_France.1252",
- # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
- # "ja" as "Japanese" or "Japanese_Japan.932",
- # and similar.
- mingw*)
- # Test for the hypothetical native Windows locale name.
- if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr_utf8=French_France.65001
- else
- # None found.
- gt_cv_locale_fr_utf8=none
- fi
- ;;
- *)
- # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
- # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of
the
- # configure script would override the LC_ALL setting. Likewise for
- # LC_CTYPE, which is also set at the beginning of the configure
script.
- # Test for the usual locale name.
- if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null;
then
- gt_cv_locale_fr_utf8=fr_FR
- else
- # Test for the locale name with explicit encoding suffix.
- if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr_utf8=fr_FR.UTF-8
- else
- # Test for the Solaris 7 locale name.
- if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
- gt_cv_locale_fr_utf8=fr.UTF-8
+ ]])])
+ if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+ case "$host_os" in
+ # Handle native Windows specially, because there setlocale()
interprets
+ # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+ # "fr" or "fra" as "French" or "French_France.1252",
+ # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+ # "ja" as "Japanese" or "Japanese_Japan.932",
+ # and similar.
+ mingw*)
+ # Test for the hypothetical native Windows locale name.
+ if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest;
exit) 2>/dev/null; then
+ gt_cv_locale_fr_utf8=French_France.65001
else
# None found.
gt_cv_locale_fr_utf8=none
fi
- fi
- fi
- ;;
- esac
- fi
- rm -fr conftest*
+ ;;
+ *)
+ # Setting LC_ALL is not enough. Need to set LC_TIME to empty,
because
+ # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning
of the
+ # configure script would override the LC_ALL setting. Likewise
for
+ # LC_CTYPE, which is also set at the beginning of the configure
script.
+ # Test for the usual locale name.
+ if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr_utf8=fr_FR
+ else
+ # Test for the locale name with explicit encoding suffix.
+ if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr_utf8=fr_FR.UTF-8
+ else
+ # Test for the Solaris 7 locale name.
+ if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit)
2>/dev/null; then
+ gt_cv_locale_fr_utf8=fr.UTF-8
+ else
+ # None found.
+ gt_cv_locale_fr_utf8=none
+ fi
+ fi
+ fi
+ ;;
+ esac
+ fi
+ rm -fr conftest*
+ ;;
+ esac
])
LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8
AC_SUBST([LOCALE_FR_UTF8])
+
+ dnl Users of $LOCALE_FR_UTF8 need to know which of the locale categories they
+ dnl can rely on.
+ case "$host_os" in
+ *-musl* | midipix*)
+ dnl On musl libc, locale categories other than LC_CTYPE and LC_MESSAGES
+ dnl are effectively unimplemented.
+ LC_COLLATE_IMPLEMENTED=false
+ LC_NUMERIC_IMPLEMENTED=false
+ LC_TIME_IMPLEMENTED=false
+ LC_MONETARY_IMPLEMENTED=false
+ ;;
+ *)
+ LC_COLLATE_IMPLEMENTED=true
+ LC_NUMERIC_IMPLEMENTED=true
+ LC_TIME_IMPLEMENTED=true
+ LC_MONETARY_IMPLEMENTED=true
+ ;;
+ esac
+ AC_SUBST([LC_COLLATE_IMPLEMENTED])
+ AC_SUBST([LC_NUMERIC_IMPLEMENTED])
+ AC_SUBST([LC_TIME_IMPLEMENTED])
+ AC_SUBST([LC_MONETARY_IMPLEMENTED])
])
diff --git a/m4/mbrlen.m4 b/m4/mbrlen.m4
index c3f0494493..2ea1513ba3 100644
--- a/m4/mbrlen.m4
+++ b/m4/mbrlen.m4
@@ -1,4 +1,4 @@
-# mbrlen.m4 serial 11 -*- coding: utf-8 -*-
+# mbrlen.m4 serial 12 -*- coding: utf-8 -*-
dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -116,7 +116,8 @@ AC_DEFUN([gl_MBRLEN_RETVAL]
{
int result = 0;
/* This fails on Solaris. */
- if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+ if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{
char input[] = "B\303\274\303\237er"; /* "Büßer" */
mbstate_t state;
@@ -130,7 +131,8 @@ AC_DEFUN([gl_MBRLEN_RETVAL]
}
}
/* This fails on HP-UX 11.11. */
- if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+ if (strcmp ("$LOCALE_JA", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
{
char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
mbstate_t state;
diff --git a/m4/mbrtoc32.m4 b/m4/mbrtoc32.m4
index b53636236c..52dd913f8a 100644
--- a/m4/mbrtoc32.m4
+++ b/m4/mbrtoc32.m4
@@ -1,4 +1,4 @@
-# mbrtoc32.m4 serial 14
+# mbrtoc32.m4 serial 15
dnl Copyright (C) 2014-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -212,7 +212,8 @@ AC_DEFUN([gl_MBRTOC32_SANITYCHECK]
/* This fails on native Windows:
mbrtoc32 returns (size_t)-1.
mbrtowc returns 1 (correct). */
- if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+ if (strcmp ("$LOCALE_FR", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
{
mbstate_t state;
wchar_t wc = (wchar_t) 0xBADFACE;
@@ -228,7 +229,8 @@ AC_DEFUN([gl_MBRTOC32_SANITYCHECK]
/* This fails on FreeBSD 13.0 and Solaris 11.4:
mbrtoc32 returns (size_t)-2 or (size_t)-1.
mbrtowc returns 4 (correct). */
- if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+ if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
{
mbstate_t state;
wchar_t wc = (wchar_t) 0xBADFACE;
diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4
index 893faff637..6173ded2ff 100644
--- a/m4/mbrtowc.m4
+++ b/m4/mbrtowc.m4
@@ -1,4 +1,4 @@
-# mbrtowc.m4 serial 40 -*- coding: utf-8 -*-
+# mbrtowc.m4 serial 41 -*- coding: utf-8 -*-
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2023 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -429,7 +429,8 @@ AC_DEFUN([gl_MBRTOWC_RETVAL]
int result = 0;
int found_some_locale = 0;
/* This fails on Solaris. */
- if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+ if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{
char input[] = "B\303\274\303\237er"; /* "Büßer" */
mbstate_t state;
@@ -445,7 +446,8 @@ AC_DEFUN([gl_MBRTOWC_RETVAL]
found_some_locale = 1;
}
/* This fails on HP-UX 11.11. */
- if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+ if (strcmp ("$LOCALE_JA", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
{
char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
mbstate_t state;
diff --git a/m4/mbsrtowcs.m4 b/m4/mbsrtowcs.m4
index 4f2e88c5a0..720f727f95 100644
--- a/m4/mbsrtowcs.m4
+++ b/m4/mbsrtowcs.m4
@@ -1,4 +1,4 @@
-# mbsrtowcs.m4 serial 15
+# mbsrtowcs.m4 serial 16
dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -78,7 +78,8 @@ AC_DEFUN([gl_MBSRTOWCS_WORKS]
int result = 0;
/* Test whether the function supports a NULL destination argument.
This fails on native Windows. */
- if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+ if (strcmp ("$LOCALE_FR", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
{
const char input[] = "\337er";
const char *src = input;
@@ -91,7 +92,8 @@ AC_DEFUN([gl_MBSRTOWCS_WORKS]
}
/* Test whether the function works when started with a conversion state
in non-initial state. This fails on HP-UX 11.11 and Solaris 10. */
- if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+ if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{
const char input[] = "B\303\274\303\237er";
mbstate_t state;
@@ -105,7 +107,8 @@ AC_DEFUN([gl_MBSRTOWCS_WORKS]
result |= 2;
}
}
- if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+ if (strcmp ("$LOCALE_JA", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
{
const char input[] = "<\306\374\313\334\270\354>";
mbstate_t state;
@@ -119,7 +122,8 @@ AC_DEFUN([gl_MBSRTOWCS_WORKS]
result |= 4;
}
}
- if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+ if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
{
const char input[] = "B\250\271\201\060\211\070er";
mbstate_t state;
diff --git a/m4/wcrtomb.m4 b/m4/wcrtomb.m4
index d51b36e17e..fa503b5335 100644
--- a/m4/wcrtomb.m4
+++ b/m4/wcrtomb.m4
@@ -1,4 +1,4 @@
-# wcrtomb.m4 serial 17
+# wcrtomb.m4 serial 18
dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -97,12 +97,14 @@ AC_DEFUN([gl_FUNC_WCRTOMB]
int main ()
{
int result = 0;
- if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+ if (strcmp ("$LOCALE_FR", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
{
if (wcrtomb (NULL, 0, NULL) != 1)
result |= 1;
}
- if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+ if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{
if (wcrtomb (NULL, 0, NULL) != 1)
result |= 2;
@@ -113,12 +115,14 @@ AC_DEFUN([gl_FUNC_WCRTOMB]
result |= 2;
}
}
- if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+ if (strcmp ("$LOCALE_JA", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
{
if (wcrtomb (NULL, 0, NULL) != 1)
result |= 4;
}
- if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+ if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
{
if (wcrtomb (NULL, 0, NULL) != 1)
result |= 8;
diff --git a/modules/c32isalpha-tests b/modules/c32isalpha-tests
index f62f78c288..2748fee325 100644
--- a/modules/c32isalpha-tests
+++ b/modules/c32isalpha-tests
@@ -7,6 +7,7 @@ m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/codeset.m4
+m4/musl.m4
Depends-on:
mbrtoc32
@@ -17,6 +18,7 @@ gt_LOCALE_FR
gt_LOCALE_FR_UTF8
gt_LOCALE_JA
gt_LOCALE_ZH_CN
+gl_MUSL_LIBC
Makefile.am:
TESTS += test-c32isalpha.sh
diff --git a/modules/c32iscntrl-tests b/modules/c32iscntrl-tests
index 097de3cf47..98a0cb8452 100644
--- a/modules/c32iscntrl-tests
+++ b/modules/c32iscntrl-tests
@@ -7,6 +7,7 @@ m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/codeset.m4
+m4/musl.m4
Depends-on:
mbrtoc32
@@ -17,6 +18,7 @@ gt_LOCALE_FR
gt_LOCALE_FR_UTF8
gt_LOCALE_JA
gt_LOCALE_ZH_CN
+gl_MUSL_LIBC
Makefile.am:
TESTS += test-c32iscntrl.sh
diff --git a/modules/c32isgraph-tests b/modules/c32isgraph-tests
index a6aac6e067..236d456323 100644
--- a/modules/c32isgraph-tests
+++ b/modules/c32isgraph-tests
@@ -7,6 +7,7 @@ m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/codeset.m4
+m4/musl.m4
Depends-on:
mbrtoc32
@@ -17,6 +18,7 @@ gt_LOCALE_FR
gt_LOCALE_FR_UTF8
gt_LOCALE_JA
gt_LOCALE_ZH_CN
+gl_MUSL_LIBC
Makefile.am:
TESTS += test-c32isgraph.sh
diff --git a/modules/c32islower-tests b/modules/c32islower-tests
index a502e28eb1..2f9aa1600d 100644
--- a/modules/c32islower-tests
+++ b/modules/c32islower-tests
@@ -7,6 +7,7 @@ m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/codeset.m4
+m4/musl.m4
Depends-on:
mbrtoc32
@@ -17,6 +18,7 @@ gt_LOCALE_FR
gt_LOCALE_FR_UTF8
gt_LOCALE_JA
gt_LOCALE_ZH_CN
+gl_MUSL_LIBC
Makefile.am:
TESTS += test-c32islower.sh
diff --git a/modules/c32isprint-tests b/modules/c32isprint-tests
index 0c13d467b4..410d4544b3 100644
--- a/modules/c32isprint-tests
+++ b/modules/c32isprint-tests
@@ -7,6 +7,7 @@ m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/codeset.m4
+m4/musl.m4
Depends-on:
mbrtoc32
@@ -17,6 +18,7 @@ gt_LOCALE_FR
gt_LOCALE_FR_UTF8
gt_LOCALE_JA
gt_LOCALE_ZH_CN
+gl_MUSL_LIBC
Makefile.am:
TESTS += test-c32isprint.sh
diff --git a/modules/c32toupper-tests b/modules/c32toupper-tests
index eeedc9df1e..3de9a9da0d 100644
--- a/modules/c32toupper-tests
+++ b/modules/c32toupper-tests
@@ -7,6 +7,7 @@ m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/codeset.m4
+m4/musl.m4
Depends-on:
mbrtoc32
@@ -18,6 +19,7 @@ gt_LOCALE_FR
gt_LOCALE_FR_UTF8
gt_LOCALE_JA
gt_LOCALE_ZH_CN
+gl_MUSL_LIBC
Makefile.am:
TESTS += test-c32toupper.sh
diff --git a/modules/nl_langinfo-tests b/modules/nl_langinfo-tests
index b44569eb16..6857ef5c2b 100644
--- a/modules/nl_langinfo-tests
+++ b/modules/nl_langinfo-tests
@@ -9,6 +9,7 @@ tests/macros.h
m4/locale-fr.m4
m4/codeset.m4
m4/intl-thread-locale.m4
+m4/musl.m4
Depends-on:
c-strcase
@@ -22,6 +23,7 @@ configure.ac:
gt_LOCALE_FR
gt_LOCALE_FR_UTF8
gt_FUNC_USELOCALE
+gl_MUSL_LIBC
Makefile.am:
TESTS += test-nl_langinfo1.sh test-nl_langinfo2.sh test-nl_langinfo-mt
diff --git a/modules/strtod-tests b/modules/strtod-tests
index c654264c3d..cbc8030ca4 100644
--- a/modules/strtod-tests
+++ b/modules/strtod-tests
@@ -24,6 +24,7 @@ check_PROGRAMS += test-strtod
TESTS += test-strtod1.sh
TESTS_ENVIRONMENT += \
LOCALE_FR='@LOCALE_FR@' \
- LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
+ LC_NUMERIC_IMPLEMENTED='@LC_NUMERIC_IMPLEMENTED@'
check_PROGRAMS += test-strtod1
test_strtod1_LDADD = $(LDADD) $(SETLOCALE_LIB)
diff --git a/modules/strtold-tests b/modules/strtold-tests
index 0d35390877..1c270954ad 100644
--- a/modules/strtold-tests
+++ b/modules/strtold-tests
@@ -24,6 +24,7 @@ check_PROGRAMS += test-strtold
TESTS += test-strtold1.sh
TESTS_ENVIRONMENT += \
LOCALE_FR='@LOCALE_FR@' \
- LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
+ LC_NUMERIC_IMPLEMENTED='@LC_NUMERIC_IMPLEMENTED@'
check_PROGRAMS += test-strtold1
test_strtold1_LDADD = $(LDADD) $(SETLOCALE_LIB)
diff --git a/modules/vasnprintf-posix-tests b/modules/vasnprintf-posix-tests
index 2ff8fc1da3..b9aabe665f 100644
--- a/modules/vasnprintf-posix-tests
+++ b/modules/vasnprintf-posix-tests
@@ -22,7 +22,10 @@ gt_LOCALE_FR_UTF8
Makefile.am:
TESTS += test-vasnprintf-posix test-vasnprintf-posix2.sh test-vasnprintf-posix3
-TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += \
+ LOCALE_FR='@LOCALE_FR@' \
+ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
+ LC_NUMERIC_IMPLEMENTED='@LC_NUMERIC_IMPLEMENTED@'
check_PROGRAMS += test-vasnprintf-posix test-vasnprintf-posix2
test-vasnprintf-posix3
test_vasnprintf_posix2_LDADD = $(LDADD) $(SETLOCALE_LIB)
test_vasnprintf_posix3_LDADD = $(LDADD) $(SETLOCALE_LIB)
diff --git a/modules/vasnwprintf-posix-tests b/modules/vasnwprintf-posix-tests
index 6354e79f75..4a693a1b98 100644
--- a/modules/vasnwprintf-posix-tests
+++ b/modules/vasnwprintf-posix-tests
@@ -28,7 +28,10 @@ gt_LOCALE_FR_UTF8
Makefile.am:
TESTS += test-vasnwprintf-posix test-vasnwprintf-posix2.sh
test-vasnwprintf-posix3
-TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += \
+ LOCALE_FR='@LOCALE_FR@' \
+ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
+ LC_NUMERIC_IMPLEMENTED='@LC_NUMERIC_IMPLEMENTED@'
check_PROGRAMS += test-vasnwprintf-posix test-vasnwprintf-posix2
test-vasnwprintf-posix3
test_vasnwprintf_posix_LDADD = $(LDADD) $(MBRTOWC_LIB)
test_vasnwprintf_posix2_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
diff --git a/tests/test-c32isalpha.c b/tests/test-c32isalpha.c
index dcb24d1fe8..90f79192a0 100644
--- a/tests/test-c32isalpha.c
+++ b/tests/test-c32isalpha.c
@@ -186,7 +186,7 @@ main (int argc, char *argv[])
/* U+3001 IDEOGRAPHIC COMMA */
is = for_character ("\343\200\201", 3);
ASSERT (is == 0);
- #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined
__CYGWIN__)
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX ||
defined __sun || defined __CYGWIN__)
/* U+FF11 FULLWIDTH DIGIT ONE */
is = for_character ("\357\274\221", 3);
ASSERT (is == 0);
diff --git a/tests/test-c32iscntrl.c b/tests/test-c32iscntrl.c
index 4cb23e1f8d..dd935ac8c1 100644
--- a/tests/test-c32iscntrl.c
+++ b/tests/test-c32iscntrl.c
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
/* U+00A0 NO-BREAK SPACE */
is = for_character ("\302\240", 2);
ASSERT (is == 0);
- #if !(defined __GLIBC__ || defined __FreeBSD__ || defined
__DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__)
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined __FreeBSD__ ||
defined __DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__)
/* U+202E RIGHT-TO-LEFT OVERRIDE */
is = for_character ("\342\200\256", 3);
ASSERT (is != 0);
@@ -153,7 +153,7 @@ main (int argc, char *argv[])
/* U+3000 IDEOGRAPHIC SPACE */
is = for_character ("\343\200\200", 3);
ASSERT (is == 0);
- #if !(defined __GLIBC__ || defined __FreeBSD__ || defined
__DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__)
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined __FreeBSD__ ||
defined __DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__)
/* U+FEFF ZERO WIDTH NO-BREAK SPACE */
is = for_character ("\357\273\277", 3);
ASSERT (is != 0);
@@ -161,7 +161,7 @@ main (int argc, char *argv[])
/* U+20000 <CJK Ideograph> */
is = for_character ("\360\240\200\200", 4);
ASSERT (is == 0);
- #if !(defined __GLIBC__ || defined __FreeBSD__ || defined
__DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__ ||
(defined _WIN32 && !defined __CYGWIN__))
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined __FreeBSD__ ||
defined __DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__ ||
(defined _WIN32 && !defined __CYGWIN__))
/* U+E0001 LANGUAGE TAG */
is = for_character ("\363\240\200\201", 4);
ASSERT (is != 0);
diff --git a/tests/test-c32isgraph.c b/tests/test-c32isgraph.c
index 31e0838d19..5edf44d465 100644
--- a/tests/test-c32isgraph.c
+++ b/tests/test-c32isgraph.c
@@ -166,7 +166,7 @@ main (int argc, char *argv[])
/* U+2002 EN SPACE */
is = for_character ("\342\200\202", 3);
ASSERT (is == 0);
- #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined
__CYGWIN__)
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX ||
defined __sun || defined __CYGWIN__)
/* U+202E RIGHT-TO-LEFT OVERRIDE */
is = for_character ("\342\200\256", 3);
ASSERT (is == 0);
@@ -174,7 +174,7 @@ main (int argc, char *argv[])
/* U+3000 IDEOGRAPHIC SPACE */
is = for_character ("\343\200\200", 3);
ASSERT (is == 0);
- #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined
__CYGWIN__)
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX ||
defined __sun || defined __CYGWIN__)
/* U+FEFF ZERO WIDTH NO-BREAK SPACE */
is = for_character ("\357\273\277", 3);
ASSERT (is == 0);
@@ -184,7 +184,7 @@ main (int argc, char *argv[])
is = for_character ("\360\240\200\200", 4);
ASSERT (is != 0);
#endif
- #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined
__CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX ||
defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
/* U+E0001 LANGUAGE TAG */
is = for_character ("\363\240\200\201", 4);
ASSERT (is == 0);
diff --git a/tests/test-c32islower.c b/tests/test-c32islower.c
index 78de25ae60..6d4e222bc3 100644
--- a/tests/test-c32islower.c
+++ b/tests/test-c32islower.c
@@ -202,7 +202,7 @@ main (int argc, char *argv[])
/* U+00B2 SUPERSCRIPT TWO */
is = for_character ("\302\262", 2);
ASSERT (is == 0);
- #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) ||
defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined
_AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined
__CYGWIN__))
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ &&
defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined
__NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined
_WIN32 && !defined __CYGWIN__))
/* U+00B5 MICRO SIGN */
is = for_character ("\302\265", 2);
ASSERT (is == 0);
diff --git a/tests/test-c32isprint.c b/tests/test-c32isprint.c
index 498605d8f7..538c371f16 100644
--- a/tests/test-c32isprint.c
+++ b/tests/test-c32isprint.c
@@ -169,7 +169,7 @@ main (int argc, char *argv[])
is = for_character ("\342\200\202", 3);
ASSERT (is != 0);
#endif
- #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined
__CYGWIN__)
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX ||
defined __sun || defined __CYGWIN__)
/* U+202E RIGHT-TO-LEFT OVERRIDE */
is = for_character ("\342\200\256", 3);
ASSERT (is == 0);
@@ -179,7 +179,7 @@ main (int argc, char *argv[])
is = for_character ("\343\200\200", 3);
ASSERT (is != 0);
#endif
- #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined
__CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX ||
defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
/* U+FEFF ZERO WIDTH NO-BREAK SPACE */
is = for_character ("\357\273\277", 3);
ASSERT (is == 0);
@@ -189,7 +189,7 @@ main (int argc, char *argv[])
is = for_character ("\360\240\200\200", 4);
ASSERT (is != 0);
#endif
- #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined
__CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX ||
defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
/* U+E0001 LANGUAGE TAG */
is = for_character ("\363\240\200\201", 4);
ASSERT (is == 0);
diff --git a/tests/test-c32toupper.c b/tests/test-c32toupper.c
index 37f0134de8..af27bbca09 100644
--- a/tests/test-c32toupper.c
+++ b/tests/test-c32toupper.c
@@ -259,7 +259,7 @@ main (int argc, char *argv[])
mb = for_character ("\302\262", 2);
ASSERT (mb.nbytes == 2);
ASSERT (memcmp (mb.buf, "\302\262", 2) == 0);
- #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) ||
defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined
_AIX || defined __sun || defined __CYGWIN__)
+ #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ &&
defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined
__NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
/* U+00B5 MICRO SIGN */
mb = for_character ("\302\265", 2);
ASSERT (mb.nbytes == 2);
@@ -269,10 +269,12 @@ main (int argc, char *argv[])
mb = for_character ("\303\211", 2);
ASSERT (mb.nbytes == 2);
ASSERT (memcmp (mb.buf, "\303\211", 2) == 0);
+ #if !defined MUSL_LIBC
/* U+00DF LATIN SMALL LETTER SHARP S */
mb = for_character ("\303\237", 2);
ASSERT (mb.nbytes == 2);
ASSERT (memcmp (mb.buf, "\303\237", 2) == 0);
+ #endif
#if !(defined _WIN32 && !defined __CYGWIN__)
/* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
mb = for_character ("\303\251", 2);
diff --git a/tests/test-nl_langinfo1.c b/tests/test-nl_langinfo1.c
index 5254f8626e..afd40b48c5 100644
--- a/tests/test-nl_langinfo1.c
+++ b/tests/test-nl_langinfo1.c
@@ -139,7 +139,7 @@ main (int argc, char *argv[])
{
const char *currency = nl_langinfo (CRNCYSTR);
ASSERT (strlen (currency) >= 0);
-#if !defined __NetBSD__
+#if !(defined MUSL_LIBC || defined __NetBSD__)
if (pass > 0)
ASSERT (strlen (currency) >= 1);
#endif
diff --git a/tests/test-nl_langinfo2.c b/tests/test-nl_langinfo2.c
index 7f276da83d..108858be34 100644
--- a/tests/test-nl_langinfo2.c
+++ b/tests/test-nl_langinfo2.c
@@ -86,6 +86,10 @@ main (int argc, char *argv[])
ASSERT (c_strcasecmp (fr_CODESET, "UTF-8") == 0
|| c_strcasecmp (fr_CODESET, "UTF8") == 0);
+ /* In musl libc, locales differ at most in the LC_MESSAGES
+ category. */
+ #if !defined MUSL_LIBC
+
/* nl_langinfo items of the LC_NUMERIC category */
const char *fr_RADIXCHAR = nl_langinfo (RADIXCHAR);
ASSERT (strcmp (fr_RADIXCHAR, ",") == 0);
@@ -113,9 +117,15 @@ main (int argc, char *argv[])
&& strcmp (fr_CRNCYSTR + 1, "€") == 0);
#endif
+ #endif
+
/* nl_langinfo items of the LC_MESSAGES category */
+ /* In musl libc, this works only if the package 'musl-locales' is
+ installed. */
+ #if !defined MUSL_LIBC
const char *fr_YESEXPR = nl_langinfo (YESEXPR);
ASSERT (c_strcasestr (fr_YESEXPR, "o" /* from "oui" */) != NULL);
+ #endif
skipped_all = false;
}
diff --git a/tests/test-strtod1.sh b/tests/test-strtod1.sh
index 1b2de5926a..306ca52e27 100755
--- a/tests/test-strtod1.sh
+++ b/tests/test-strtod1.sh
@@ -12,6 +12,13 @@ if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none;
then
exit 77
fi
+if $LC_NUMERIC_IMPLEMENTED; then
+ :
+else
+ echo "Skipping test: LC_NUMERIC category of locales is not implemented"
+ exit 77
+fi
+
if test $LOCALE_FR != none; then
LC_ALL=$LOCALE_FR ${CHECKER} ./test-strtod1${EXEEXT} || exit 1
fi
diff --git a/tests/test-strtold1.sh b/tests/test-strtold1.sh
index 1302c19931..3af4576115 100755
--- a/tests/test-strtold1.sh
+++ b/tests/test-strtold1.sh
@@ -12,6 +12,13 @@ if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none;
then
exit 77
fi
+if $LC_NUMERIC_IMPLEMENTED; then
+ :
+else
+ echo "Skipping test: LC_NUMERIC category of locales is not implemented"
+ exit 77
+fi
+
if test $LOCALE_FR != none; then
LC_ALL=$LOCALE_FR ${CHECKER} ./test-strtold1${EXEEXT} || exit 1
fi
diff --git a/tests/test-vasnprintf-posix2.sh b/tests/test-vasnprintf-posix2.sh
index 79c1e2f76f..e488e94e97 100755
--- a/tests/test-vasnprintf-posix2.sh
+++ b/tests/test-vasnprintf-posix2.sh
@@ -18,5 +18,12 @@ else
fi
fi
+if $LC_NUMERIC_IMPLEMENTED; then
+ :
+else
+ echo "Skipping test: LC_NUMERIC category of locales is not implemented"
+ exit 77
+fi
+
LC_ALL=$testlocale \
${CHECKER} ./test-vasnprintf-posix2${EXEEXT}
diff --git a/tests/test-vasnwprintf-posix2.sh b/tests/test-vasnwprintf-posix2.sh
index 7a5a36476c..ecff3c9f65 100755
--- a/tests/test-vasnwprintf-posix2.sh
+++ b/tests/test-vasnwprintf-posix2.sh
@@ -18,5 +18,12 @@ else
fi
fi
+if $LC_NUMERIC_IMPLEMENTED; then
+ :
+else
+ echo "Skipping test: LC_NUMERIC category of locales is not implemented"
+ exit 77
+fi
+
LC_ALL=$testlocale \
${CHECKER} ./test-vasnwprintf-posix2${EXEEXT}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Make internationalization tests stricter on musl systems,
Bruno Haible <=