changeset 40044:74054cd6d907

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.
author Bruno Haible <bruno@clisp.org>
date Tue, 18 Dec 2018 09:59:41 +0100
parents b3a43d4c1a81
children 753e4de5f3eb
files ChangeLog modules/duplocale-tests tests/test-duplocale.c
diffstat 3 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Dec 18 09:49:42 2018 +0100
+++ b/ChangeLog	Tue Dec 18 09:59:41 2018 +0100
@@ -1,3 +1,12 @@
+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.
--- a/modules/duplocale-tests	Tue Dec 18 09:49:42 2018 +0100
+++ b/modules/duplocale-tests	Tue Dec 18 09:59:41 2018 +0100
@@ -2,13 +2,15 @@
 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
--- a/tests/test-duplocale.c	Tue Dec 18 09:49:42 2018 +0100
+++ b/tests/test-duplocale.c	Tue Dec 18 09:59:41 2018 +0100
@@ -59,7 +59,7 @@
   /* result->time is usually "janvier" */
 }
 
-#if HAVE_USELOCALE
+#if HAVE_WORKING_USELOCALE
 
 static int
 test_with_uselocale (void)
@@ -135,7 +135,7 @@
 
 #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 @@
               "%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 @@
 #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 @@
 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