bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* nl_langinfo tests: Avoid test failure on Solaris 11
@ 2023-03-02  8:23 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2023-03-02  8:23 UTC (permalink / raw)
  To: bug-gnulib

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);





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-02  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-02  8:23 nl_langinfo tests: Avoid test failure on Solaris 11 Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).