From patchwork Thu Sep 24 21:58:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 8844 Received: (qmail 8334 invoked by alias); 24 Sep 2015 21:58:21 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 8320 invoked by uid 89); 24 Sep 2015 21:58:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f178.google.com X-Received: by 10.55.22.143 with SMTP id 15mr2503777qkw.38.1443131896625; Thu, 24 Sep 2015 14:58:16 -0700 (PDT) Message-ID: <560471F5.9080800@gmail.com> Date: Thu, 24 Sep 2015 15:58:13 -0600 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: GNU C Library Subject: [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 * 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