bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nl_langinfo tests: Avoid test failure on Solaris 11


From: Bruno Haible
Subject: nl_langinfo tests: Avoid test failure on Solaris 11
Date: Thu, 02 Mar 2023 09:23:42 +0100

On Solaris 11, I see a test failure:

../../gnulib-tests/test-nl_langinfo2.c:100: assertion 'strlen (fr_T_FMT_AMPM) 
== 0 || strcmp (fr_T_FMT_AMPM, "%I:%M:%S") == 0' failed
../../gnulib-tests/test-nl_langinfo2.sh: line 12: 17260: Abort(coredump)

The problem is that
Solaris OpenIndiana: fr_T_FMT_AMPM = "%I:%M:%S %p"
Solaris 11.4:        fr_T_FMT_AMPM = "%l:%M:%S %p"

Which is unreasonable, since in France, a 24 hour time display is used, with
"du matin / de l'après-midi / du soir".

The point of this unit test, however, is to test nl_langinfo in multithreaded
situations, not to check the quality of the localizations. While glibc has
reasonable values for T_FMT_AMPM, see
  https://lh.2xlibre.net/values/t_fmt_ampm/
other platforms (like macOS and Solaris) apparently don't.


2023-03-02  Bruno Haible  <bruno@clisp.org>

        nl_langinfo tests: Avoid test failure on Solaris 11.
        * tests/test-nl_langinfo2.c (main): Skip French T_FMT_AMPM test on
        Solaris.

diff --git a/tests/test-nl_langinfo2.c b/tests/test-nl_langinfo2.c
index 4625a8a0f8..7f276da83d 100644
--- a/tests/test-nl_langinfo2.c
+++ b/tests/test-nl_langinfo2.c
@@ -91,9 +91,9 @@ main (int argc, char *argv[])
               ASSERT (strcmp (fr_RADIXCHAR, ",") == 0);
 
               /* nl_langinfo items of the LC_TIME category */
-              /* macOS doesn't get the LC_TIME values right.
+              /* macOS and Solaris 11 don't get the LC_TIME values right.
                  Poor.  */
-              #if !(defined __APPLE__ && defined __MACH__)
+              #if !((defined __APPLE__ && defined __MACH__) || defined __sun)
               const char *fr_T_FMT_AMPM = nl_langinfo (T_FMT_AMPM);
               const char *fr_AM_STR = nl_langinfo (AM_STR);
               const char *fr_PM_STR = nl_langinfo (PM_STR);






reply via email to

[Prev in Thread] Current Thread [Next in Thread]