summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2018-12-18 09:59:41 +0100
committerBruno Haible <bruno@clisp.org>2018-12-18 09:59:41 +0100
commit0d6e3307bbdb8df4d56043d5f373eeeffe4cbef3 (patch)
tree109c837f9a3d434b2c83f06e4cdf8efea4d4dd15
parent55e1fc818eed5ce14c76e366685e29b163f23684 (diff)
downloadgnulib-0d6e3307bbdb8df4d56043d5f373eeeffe4cbef3.tar.gz
duplocale: Avoid test failure on AIX 7.
* modules/duplocale-tests (Files): Add m4/intl-thread-locale.m4. (configure.ac): Invoke gt_FUNC_USELOCALE. * tests/test-duplocale.c: Test HAVE_WORKING_USELOCALE instead of HAVE_USELOCALE. Assume that nl_langinfo_l only works when uselocale works.
-rw-r--r--ChangeLog9
-rw-r--r--modules/duplocale-tests4
-rw-r--r--tests/test-duplocale.c12
3 files changed, 18 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index b99207b446..f55c615b0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2018-12-18 Bruno Haible <bruno@clisp.org>
+ duplocale: Avoid test failure on AIX 7.
+ * modules/duplocale-tests (Files): Add m4/intl-thread-locale.m4.
+ (configure.ac): Invoke gt_FUNC_USELOCALE.
+ * tests/test-duplocale.c: Test HAVE_WORKING_USELOCALE instead of
+ HAVE_USELOCALE. Assume that nl_langinfo_l only works when uselocale
+ works.
+
+2018-12-18 Bruno Haible <bruno@clisp.org>
+
localename: Fix test failure on AIX 7.
Reported by Assaf Gordon in
<https://lists.gnu.org/archive/html/sed-devel/2018-12/msg00019.html>.
diff --git a/modules/duplocale-tests b/modules/duplocale-tests
index baa9a63102..29b2a1a02d 100644
--- a/modules/duplocale-tests
+++ b/modules/duplocale-tests
@@ -2,13 +2,15 @@ Files:
tests/test-duplocale.c
tests/signature.h
tests/macros.h
+m4/intl-thread-locale.m4
Depends-on:
langinfo
configure.ac:
-AC_CHECK_FUNCS_ONCE([duplocale uselocale strfmon_l snprintf_l nl_langinfo_l])
+AC_CHECK_FUNCS_ONCE([duplocale strfmon_l snprintf_l nl_langinfo_l])
AC_CHECK_HEADERS_ONCE([monetary.h])
+gt_FUNC_USELOCALE
Makefile.am:
TESTS += test-duplocale
diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c
index 1cf1089c7b..20977160fd 100644
--- a/tests/test-duplocale.c
+++ b/tests/test-duplocale.c
@@ -59,7 +59,7 @@ get_locale_dependent_values (struct locale_dependent_values *result)
/* result->time is usually "janvier" */
}
-#if HAVE_USELOCALE
+#if HAVE_WORKING_USELOCALE
static int
test_with_uselocale (void)
@@ -135,7 +135,7 @@ test_with_uselocale (void)
#endif
-#if HAVE_STRFMON_L || HAVE_SNPRINTF_L || HAVE_NL_LANGINFO_L
+#if HAVE_STRFMON_L || HAVE_SNPRINTF_L || (HAVE_NL_LANGINFO_L && HAVE_WORKING_USELOCALE)
static void
get_locale_dependent_values_from (struct locale_dependent_values *result, locale_t locale)
@@ -150,7 +150,7 @@ get_locale_dependent_values_from (struct locale_dependent_values *result, locale
"%g", 3.5);
/* result->numeric is usually "3,5" */
#endif
-#if HAVE_NL_LANGINFO_L
+#if HAVE_NL_LANGINFO_L && HAVE_WORKING_USELOCALE
strcpy (result->time, nl_langinfo_l (MON_1, locale));
/* result->time is usually "janvier" */
#endif
@@ -201,7 +201,7 @@ test_with_locale_parameter (void)
#if HAVE_SNPRINTF_L
ASSERT (strcmp (results.numeric, expected_results.numeric) == 0);
#endif
-#if HAVE_NL_LANGINFO_L
+#if HAVE_NL_LANGINFO_L && HAVE_WORKING_USELOCALE
ASSERT (strcmp (results.time, expected_results.time) == 0);
#endif
}
@@ -217,10 +217,10 @@ int
main ()
{
int skipped = 0;
-#if HAVE_USELOCALE
+#if HAVE_WORKING_USELOCALE
skipped |= test_with_uselocale ();
#endif
-#if HAVE_STRFMON_L || HAVE_SNPRINTF_L || HAVE_NL_LANGINFO_L
+#if HAVE_STRFMON_L || HAVE_SNPRINTF_L || (HAVE_NL_LANGINFO_L && HAVE_WORKING_USELOCALE)
skipped |= test_with_locale_parameter ();
#endif