This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] 18969 - multiple string test failures due to missing locale dependencies


After glibc has been built but before 'make check' has been invoked,
running 'make check subdirs=string' causes four string tests to fail
that otherwise succeed.  The failures can also be reproduced by
removing the contents of the localedata directory and invoking make
check as shown below.  The cause of the failures is a missing
dependency of the string makefile on the locales used by string tests.

In addition, while three of the four tests produce output that makes
the reason for their failures clear by printing the names of the
locales they couldn't set, string/tst-strxfrm2 prints the less helpful
"setlocale failed."

The patch attached to the bug and copied below fixes both problems
by a) adding the missing dependency on gen-locales.mk to
string/Makefile and setting the LOCALES variable to the names of
the prerequisite locales, and b) printing the name of the failed
locale in tst-strxfrm2.

The patch was tested on powerpc64le.

Martin

$ rm -rf localedata/* string/test-*.out; nice make subdirs=string -k check
...
FAIL: string/test-strcasecmp
FAIL: string/test-strncasecmp
FAIL: string/tst-strxfrm
FAIL: string/tst-strxfrm2
Summary of test results:
      4 FAIL
     55 PASS
make[1]: *** [tests] Error 1
make[1]: Target `check' not remade because of errors.


2015-09-15  Martin Sebor  <msebor@redhat.com>

	* string/Makefile (LOCALES): Define.
	(gen-locales.mk): Include.
	(test-strcasecmp.out, test-strncasecmp.out, tst-strxfrm.out)
	(tst-strxfrm2.out): Add deppendency on $(gen-locales).
	* string/tst-strxfrm2.c (do_test): Print the name of the locale
	on setlocale failure.

diff --git a/string/Makefile b/string/Makefile
index 8424a61..0d8df0b 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -75,4 +75,13 @@ ifeq ($(run-built-tests),yes)
 $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
        cmp $^ > $@; \
        $(evaluate-test)
+
+LOCALES = de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 tr_TR.ISO-8859-9 tr_TR.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)test-strcasecmp.out: $(gen-locales)
+$(objpfx)test-strncasecmp.out: $(gen-locales)
+$(objpfx)tst-strxfrm.out: $(gen-locales)
+$(objpfx)tst-strxfrm2.out: $(gen-locales)
+
 endif
diff --git a/string/tst-strxfrm2.c b/string/tst-strxfrm2.c
index d5a1115..bea5aa2 100644
--- a/string/tst-strxfrm2.c
+++ b/string/tst-strxfrm2.c
@@ -5,6 +5,8 @@
 static int
 do_test (void)
 {
+  static const char test_locale[] = "de_DE.UTF-8";
+
   int res = 0;

   char buf[20];
@@ -38,9 +40,9 @@ do_test (void)
       res = 1;
     }

-  if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
+  if (setlocale (LC_ALL, test_locale) == NULL)
     {
-      puts ("setlocale failed");
+      printf ("cannot set locale \"%s\"\n", test_locale);
       res = 1;
     }
   else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]