18969 - multiple string test failures due to missing locale dependencies

Message ID mvmd1wkz089.fsf@hawking.suse.de
State Committed
Headers

Commit Message

Andreas Schwab Oct. 12, 2015, 1:26 p.m. UTC
  The same is true for many other subdirs.  I have installed the patch
below to fix that.  There were also two tests that depended on the
environment for the locale to use, I have changed them to use an
explicit locale.

Andreas.

	* debug/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)tst-chk1.out): Depend on $(gen-locales).
	* iconvdata/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)bug-iconv6.out, $(objpfx)tst-iconv7.out): Depend on
	$(gen-locales).
	* intl/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)tst-codeset.out, $(objpfx)tst-gettext.out)
	($(objpfx)tst-gettext2.out, $(objpfx)tst-gettext3.out)
	($(objpfx)tst-gettext4.out, $(objpfx)tst-gettext5.out)
	($(objpfx)tst-gettext6.out, $(objpfx)tst-translit.out): Depend on
	$(gen-locales).
	* libio/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)bug-ftell.out, $(objpfx)bug-ungetwc1.out)
	($(objpfx)bug-ungetwc2.out, $(objpfx)tst-fgetwc.out)
	($(objpfx)tst-fgetws.out, $(objpfx)tst-fopenloc.out)
	($(objpfx)tst-fputws.out, $(objpfx)tst-fseek.out)
	($(objpfx)tst-ftell-active-handler.out)
	($(objpfx)tst-ftell-append.out)
	($(objpfx)tst-ftell-partial-wide.out, $(objpfx)tst-setvbuf1.out)
	($(objpfx)tst-swscanf.out, $(objpfx)tst-ungetwc1.out)
	($(objpfx)tst-ungetwc2.out, $(objpfx)tst-widetext.out)
	($(objpfx)tst_wprintf2.out): Depend on $(gen-locales).
	* posix/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)bug-regex1.out, $(objpfx)bug-regex4.out)
	($(objpfx)bug-regex5.out, $(objpfx)bug-regex6.out)
	($(objpfx)bug-regex17.out, $(objpfx)bug-regex18.out)
	($(objpfx)bug-regex19.out, $(objpfx)bug-regex20.out)
	($(objpfx)bug-regex22.out, $(objpfx)bug-regex23.out)
	($(objpfx)bug-regex25.out, $(objpfx)bug-regex26.out)
	($(objpfx)bug-regex30.out, $(objpfx)bug-regex32.out)
	($(objpfx)bug-regex33.out, $(objpfx)bug-regex34.out)
	($(objpfx)bug-regex35.out, $(objpfx)tst-fnmatch.out)
	($(objpfx)tst-fnmatch4.out, $(objpfx)tst-fnmatch5.out)
	($(objpfx)tst-regex.out, $(objpfx)tst-regex2.out)
	($(objpfx)tst-regexloc.out, $(objpfx)tst-rxspencer.out)
	($(objpfx)tst-rxspencer-no-utf8.out): Depend on $(gen-locales).
	* stdio-common/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)bug14.out, $(objpfx)scanf13.out)
	($(objpfx)test-vfprintf.out, $(objpfx)tst-grouping.out)
	($(objpfx)tst-sprintf.out, $(objpfx)tst-sscanf.out)
	($(objpfx)tst-swprintf.out): Depend on $(gen-locales).
	* stdlib/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)bug-strtod2.out, $(objpfx)testmb2.out)
	($(objpfx)tst-strtod.out, $(objpfx)tst-strtod3.out)
	($(objpfx)tst-strtod4.out, $(objpfx)tst-strtod5.out): Depend on
	$(gen-locales).
	* time/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)tst-ftime_l.out, $(objpfx)tst-strptime.out): Depend on
	$(gen-locales).
	* wcsmbs/Makefile (LOCALES): Define.  Include gen-locales.mk.
	($(objpfx)tst-btowc.out, $(objpfx)tst-c16c32-1.out)
	($(objpfx)tst-mbrtowc.out, $(objpfx)tst-mbrtowc2.out)
	($(objpfx)tst-wcrtomb.out, $(objpfx)wcsmbs-tst1.out): Depend on
	$(gen-locales).
	* libio/tst_wprintf2.c (main): Use explicit locale.
	* wcsmbs/wcsmbs-tst1.c (main): Likewise.
  

Comments

Martin Sebor Oct. 12, 2015, 4:06 p.m. UTC | #1
On 10/12/2015 07:26 AM, Andreas Schwab wrote:
> The same is true for many other subdirs.  I have installed the patch
> below to fix that.  There were also two tests that depended on the
> environment for the locale to use, I have changed them to use an
> explicit locale.

Thank you for taking the time to do a much more thorough job than
I did.

Out of curiosity, how did you come up with the list of tests and
how did you test the fix? Based on test failures or based on some
text search?

I ask because in my experience the latter approach led to false
positives and other errors and I found the former too tedious to
do a comprehensive job.

FWIW, with your patch applied, I still see failures (possibly
some of the same ones that made me throw in the towel on doing
a more comprehensive survey of the problems).

For example:

   $ nice make subdirs=intl tests=tst-gettext3 check
   ...
   make[2]: Entering directory `/src/glibc-trunk/intl'
   ../Rules:151: target `/build/glibc-trunk/18969/intl/tst-gettext3' 
given more than once in the same rule.
   ...
   FAIL: intl/tst-codeset
   FAIL: intl/tst-gettext2
   FAIL: intl/tst-gettext3
   FAIL: intl/tst-gettext5
   FAIL: intl/tst-translit
   Summary of test results:
         5 FAIL
         7 PASS
   make[1]: *** [tests] Error 1
   make[1]: Leaving directory `/src/glibc-trunk'

It's not immediately clear to me from the console output or from
the test .out files what the problem is:

   $ cat intl/tst-gettext3.out
   call 2 returned: cheese

and

   $ nice make subdirs=libio tests=bug-ftell check
   ...
   make[2]: *** No rule to make target 
`/build/glibc-trunk/18969/libio/test-fmemopen.out', needed by 
`/build/glibc-trunk/18969/libio/test-fmemopen-mem.out'.  Stop.
   make[2]: Leaving directory `/src/glibc-trunk/libio'
   make[1]: *** [libio/tests] Error 2
   make[1]: Leaving directory `/src/glibc-trunk'
   make: *** [check] Error 2

Martin

>
> Andreas.
>
> 	* debug/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)tst-chk1.out): Depend on $(gen-locales).
> 	* iconvdata/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)bug-iconv6.out, $(objpfx)tst-iconv7.out): Depend on
> 	$(gen-locales).
> 	* intl/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)tst-codeset.out, $(objpfx)tst-gettext.out)
> 	($(objpfx)tst-gettext2.out, $(objpfx)tst-gettext3.out)
> 	($(objpfx)tst-gettext4.out, $(objpfx)tst-gettext5.out)
> 	($(objpfx)tst-gettext6.out, $(objpfx)tst-translit.out): Depend on
> 	$(gen-locales).
> 	* libio/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)bug-ftell.out, $(objpfx)bug-ungetwc1.out)
> 	($(objpfx)bug-ungetwc2.out, $(objpfx)tst-fgetwc.out)
> 	($(objpfx)tst-fgetws.out, $(objpfx)tst-fopenloc.out)
> 	($(objpfx)tst-fputws.out, $(objpfx)tst-fseek.out)
> 	($(objpfx)tst-ftell-active-handler.out)
> 	($(objpfx)tst-ftell-append.out)
> 	($(objpfx)tst-ftell-partial-wide.out, $(objpfx)tst-setvbuf1.out)
> 	($(objpfx)tst-swscanf.out, $(objpfx)tst-ungetwc1.out)
> 	($(objpfx)tst-ungetwc2.out, $(objpfx)tst-widetext.out)
> 	($(objpfx)tst_wprintf2.out): Depend on $(gen-locales).
> 	* posix/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)bug-regex1.out, $(objpfx)bug-regex4.out)
> 	($(objpfx)bug-regex5.out, $(objpfx)bug-regex6.out)
> 	($(objpfx)bug-regex17.out, $(objpfx)bug-regex18.out)
> 	($(objpfx)bug-regex19.out, $(objpfx)bug-regex20.out)
> 	($(objpfx)bug-regex22.out, $(objpfx)bug-regex23.out)
> 	($(objpfx)bug-regex25.out, $(objpfx)bug-regex26.out)
> 	($(objpfx)bug-regex30.out, $(objpfx)bug-regex32.out)
> 	($(objpfx)bug-regex33.out, $(objpfx)bug-regex34.out)
> 	($(objpfx)bug-regex35.out, $(objpfx)tst-fnmatch.out)
> 	($(objpfx)tst-fnmatch4.out, $(objpfx)tst-fnmatch5.out)
> 	($(objpfx)tst-regex.out, $(objpfx)tst-regex2.out)
> 	($(objpfx)tst-regexloc.out, $(objpfx)tst-rxspencer.out)
> 	($(objpfx)tst-rxspencer-no-utf8.out): Depend on $(gen-locales).
> 	* stdio-common/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)bug14.out, $(objpfx)scanf13.out)
> 	($(objpfx)test-vfprintf.out, $(objpfx)tst-grouping.out)
> 	($(objpfx)tst-sprintf.out, $(objpfx)tst-sscanf.out)
> 	($(objpfx)tst-swprintf.out): Depend on $(gen-locales).
> 	* stdlib/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)bug-strtod2.out, $(objpfx)testmb2.out)
> 	($(objpfx)tst-strtod.out, $(objpfx)tst-strtod3.out)
> 	($(objpfx)tst-strtod4.out, $(objpfx)tst-strtod5.out): Depend on
> 	$(gen-locales).
> 	* time/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)tst-ftime_l.out, $(objpfx)tst-strptime.out): Depend on
> 	$(gen-locales).
> 	* wcsmbs/Makefile (LOCALES): Define.  Include gen-locales.mk.
> 	($(objpfx)tst-btowc.out, $(objpfx)tst-c16c32-1.out)
> 	($(objpfx)tst-mbrtowc.out, $(objpfx)tst-mbrtowc2.out)
> 	($(objpfx)tst-wcrtomb.out, $(objpfx)wcsmbs-tst1.out): Depend on
> 	$(gen-locales).
> 	* libio/tst_wprintf2.c (main): Use explicit locale.
> 	* wcsmbs/wcsmbs-tst1.c (main): Likewise.
>
> diff --git a/debug/Makefile b/debug/Makefile
> index 9ff357b..f871ba9 100644
> --- a/debug/Makefile
> +++ b/debug/Makefile
> @@ -162,6 +162,13 @@ generated += catchsegv xtrace
>
>   include ../Rules
>
> +ifeq ($(run-built-tests),yes)
> +LOCALES := de_DE.UTF-8
> +include ../gen-locales.mk
> +
> +$(objpfx)tst-chk1.out: $(gen-locales)
> +endif
> +
>   sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
>
>   $(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
> diff --git a/iconvdata/Makefile b/iconvdata/Makefile
> index a3d1d09..0cd6518 100644
> --- a/iconvdata/Makefile
> +++ b/iconvdata/Makefile
> @@ -271,6 +271,14 @@ endif
>
>   include ../Rules
>
> +ifeq ($(run-built-tests),yes)
> +LOCALES := de_DE.UTF-8
> +include ../gen-locales.mk
> +
> +$(objpfx)bug-iconv6.out: $(gen-locales)
> +$(objpfx)tst-iconv7.out: $(gen-locales)
> +endif
> +
>   # Set libof-* for each routine.
>   cpp-srcs-left := $(modules) $(generated-modules) $(libJIS-routines) \
>   		 $(libKSC-routines) $(libGB-routines) $(libCNS-routines) \
> diff --git a/intl/Makefile b/intl/Makefile
> index 9ecf8fe..6a28c8a 100644
> --- a/intl/Makefile
> +++ b/intl/Makefile
> @@ -105,6 +105,19 @@ $(objpfx)tst-codeset.out: $(codeset_mo)
>   $(objpfx)tst-gettext3.out: $(codeset_mo)
>   $(objpfx)tst-gettext5.out: $(codeset_mo)
>   endif
> +
> +LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 fr_FR.ISO-8859-1 \
> +	   ja_JP.UTF-8
> +include ../gen-locales.mk
> +
> +$(objpfx)tst-codeset.out: $(gen-locales)
> +$(objpfx)tst-gettext.out: $(gen-locales)
> +$(objpfx)tst-gettext2.out: $(gen-locales)
> +$(objpfx)tst-gettext3.out: $(gen-locales)
> +$(objpfx)tst-gettext4.out: $(gen-locales)
> +$(objpfx)tst-gettext5.out: $(gen-locales)
> +$(objpfx)tst-gettext6.out: $(gen-locales)
> +$(objpfx)tst-translit.out: $(gen-locales)
>   endif
>
>   $(objpfx)msgs.h: po2test.awk ../po/de.po
> diff --git a/libio/Makefile b/libio/Makefile
> index a1d1741..273c240 100644
> --- a/libio/Makefile
> +++ b/libio/Makefile
> @@ -176,6 +176,30 @@ endif
>
>   include ../Rules
>
> +ifeq ($(run-built-tests),yes)
> +LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
> +	   ja_JP.EUC-JP ja_JP.UTF-8
> +include ../gen-locales.mk
> +
> +$(objpfx)bug-ftell.out: $(gen-locales)
> +$(objpfx)bug-ungetwc1.out: $(gen-locales)
> +$(objpfx)bug-ungetwc2.out: $(gen-locales)
> +$(objpfx)tst-fgetwc.out: $(gen-locales)
> +$(objpfx)tst-fgetws.out: $(gen-locales)
> +$(objpfx)tst-fopenloc.out: $(gen-locales)
> +$(objpfx)tst-fputws.out: $(gen-locales)
> +$(objpfx)tst-fseek.out: $(gen-locales)
> +$(objpfx)tst-ftell-active-handler.out: $(gen-locales)
> +$(objpfx)tst-ftell-append.out: $(gen-locales)
> +$(objpfx)tst-ftell-partial-wide.out: $(gen-locales)
> +$(objpfx)tst-setvbuf1.out: $(gen-locales)
> +$(objpfx)tst-swscanf.out: $(gen-locales)
> +$(objpfx)tst-ungetwc1.out: $(gen-locales)
> +$(objpfx)tst-ungetwc2.out: $(gen-locales)
> +$(objpfx)tst-widetext.out: $(gen-locales)
> +$(objpfx)tst_wprintf2.out: $(gen-locales)
> +endif
> +
>   $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
>   	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'	\
>   	$(common-objpfx)libio/; \
> diff --git a/libio/tst_wprintf2.c b/libio/tst_wprintf2.c
> index be0f29f..dfff70f 100644
> --- a/libio/tst_wprintf2.c
> +++ b/libio/tst_wprintf2.c
> @@ -26,7 +26,7 @@ main (int argc, char *argv[])
>
>     unlink (name);
>
> -  setlocale (LC_ALL, "");
> +  setlocale (LC_ALL, "en_US.UTF-8");
>
>     fp = fdopen (dup (fd), "w");
>     if (fp == NULL)
> diff --git a/posix/Makefile b/posix/Makefile
> index 39423a9..cbc4bc6 100644
> --- a/posix/Makefile
> +++ b/posix/Makefile
> @@ -148,6 +148,36 @@ $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
>   		 '$(run-program-env)' '$(test-program-prefix-after-env)'; \
>   	$(evaluate-test)
>   endif
> +
> +LOCALES := cs_CZ.UTF-8 da_DK.ISO-8859-1 de_DE.ISO-8859-1 de_DE.UTF-8 \
> +	   en_US.UTF-8 es_US.ISO-8859-1 es_US.UTF-8 ja_JP.EUC-JP tr_TR.UTF-8
> +include ../gen-locales.mk
> +
> +$(objpfx)bug-regex1.out: $(gen-locales)
> +$(objpfx)bug-regex4.out: $(gen-locales)
> +$(objpfx)bug-regex5.out: $(gen-locales)
> +$(objpfx)bug-regex6.out: $(gen-locales)
> +$(objpfx)bug-regex17.out: $(gen-locales)
> +$(objpfx)bug-regex18.out: $(gen-locales)
> +$(objpfx)bug-regex19.out: $(gen-locales)
> +$(objpfx)bug-regex20.out: $(gen-locales)
> +$(objpfx)bug-regex22.out: $(gen-locales)
> +$(objpfx)bug-regex23.out: $(gen-locales)
> +$(objpfx)bug-regex25.out: $(gen-locales)
> +$(objpfx)bug-regex26.out: $(gen-locales)
> +$(objpfx)bug-regex30.out: $(gen-locales)
> +$(objpfx)bug-regex32.out: $(gen-locales)
> +$(objpfx)bug-regex33.out: $(gen-locales)
> +$(objpfx)bug-regex34.out: $(gen-locales)
> +$(objpfx)bug-regex35.out: $(gen-locales)
> +$(objpfx)tst-fnmatch.out: $(gen-locales)
> +$(objpfx)tst-fnmatch4.out: $(gen-locales)
> +$(objpfx)tst-fnmatch5.out: $(gen-locales)
> +$(objpfx)tst-regex.out: $(gen-locales)
> +$(objpfx)tst-regex2.out: $(gen-locales)
> +$(objpfx)tst-regexloc.out: $(gen-locales)
> +$(objpfx)tst-rxspencer.out: $(gen-locales)
> +$(objpfx)tst-rxspencer-no-utf8.out: $(gen-locales)
>   endif
>
>   # If we will use the generic uname implementation, we must figure out what
> diff --git a/stdio-common/Makefile b/stdio-common/Makefile
> index df4122d..d92d9d1 100644
> --- a/stdio-common/Makefile
> +++ b/stdio-common/Makefile
> @@ -72,6 +72,19 @@ endif
>
>   include ../Rules
>
> +ifeq ($(run-built-tests),yes)
> +LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 ja_JP.EUC-JP
> +include ../gen-locales.mk
> +
> +$(objpfx)bug14.out: $(gen-locales)
> +$(objpfx)scanf13.out: $(gen-locales)
> +$(objpfx)test-vfprintf.out: $(gen-locales)
> +$(objpfx)tst-grouping.out: $(gen-locales)
> +$(objpfx)tst-sprintf.out: $(gen-locales)
> +$(objpfx)tst-sscanf.out: $(gen-locales)
> +$(objpfx)tst-swprintf.out: $(gen-locales)
> +endif
> +
>   tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace
>
>   $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
> diff --git a/stdlib/Makefile b/stdlib/Makefile
> index 402466a..9e0c249 100644
> --- a/stdlib/Makefile
> +++ b/stdlib/Makefile
> @@ -121,6 +121,18 @@ endif
>
>   include ../Rules
>
> +ifeq ($(run-built-tests),yes)
> +LOCALES := cs_CZ.UTF-8 de_DE.UTF-8 en_US.ISO-8859-1 tr_TR.UTF-8
> +include ../gen-locales.mk
> +
> +$(objpfx)bug-strtod2.out: $(gen-locales)
> +$(objpfx)testmb2.out: $(gen-locales)
> +$(objpfx)tst-strtod.out: $(gen-locales)
> +$(objpfx)tst-strtod3.out: $(gen-locales)
> +$(objpfx)tst-strtod4.out: $(gen-locales)
> +$(objpfx)tst-strtod5.out: $(gen-locales)
> +endif
> +
>   # Testdir has to be named stdlib and needs to be writable
>   test-canon-ARGS = --test-dir=${common-objpfx}stdlib
>
> diff --git a/time/Makefile b/time/Makefile
> index a411f62..933e70e 100644
> --- a/time/Makefile
> +++ b/time/Makefile
> @@ -41,6 +41,14 @@ tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
>
>   include ../Rules
>
> +ifeq ($(run-built-tests),yes)
> +LOCALES := de_DE.ISO-8859-1 en_US.ISO-8859-1 ja_JP.EUC-JP
> +include ../gen-locales.mk
> +
> +$(objpfx)tst-ftime_l.out: $(gen-locales)
> +$(objpfx)tst-strptime.out: $(gen-locales)
> +endif
> +
>   tz-cflags = -DTZDIR='"$(zonedir)"' \
>   	    -DTZDEFAULT='"$(localtime-file)"' \
>   	    -DTZDEFRULES='"$(posixrules-file)"'
> diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
> index dc72ba4..a59a005 100644
> --- a/wcsmbs/Makefile
> +++ b/wcsmbs/Makefile
> @@ -51,6 +51,19 @@ tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
>
>   include ../Rules
>
> +ifeq ($(run-built-tests),yes)
> +LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 hr_HR.ISO-8859-2 \
> +	   ja_JP.EUC-JP zh_TW.EUC-TW
> +include ../gen-locales.mk
> +
> +$(objpfx)tst-btowc.out: $(gen-locales)
> +$(objpfx)tst-c16c32-1.out: $(gen-locales)
> +$(objpfx)tst-mbrtowc.out: $(gen-locales)
> +$(objpfx)tst-mbrtowc2.out: $(gen-locales)
> +$(objpfx)tst-wcrtomb.out: $(gen-locales)
> +$(objpfx)wcsmbs-tst1.out: $(gen-locales)
> +endif
> +
>   CFLAGS-wcwidth.c = -I../wctype
>   CFLAGS-wcswidth.c = -I../wctype
>
> diff --git a/wcsmbs/wcsmbs-tst1.c b/wcsmbs/wcsmbs-tst1.c
> index 9cdef45..0d0e18f 100644
> --- a/wcsmbs/wcsmbs-tst1.c
> +++ b/wcsmbs/wcsmbs-tst1.c
> @@ -18,7 +18,7 @@ main (void)
>     char str[] = "Hello";
>     int result = 0;
>
> -  pchar = setlocale (LC_ALL, "");
> +  pchar = setlocale (LC_ALL, "de_DE.UTF-8");
>     printf ("locale : %s\n",pchar);
>     printf ("MB_CUR_MAX %Zd\n", MB_CUR_MAX);
>
>
  
Andreas Schwab Oct. 13, 2015, 7:11 a.m. UTC | #2
Martin Sebor <msebor@gmail.com> writes:

>   $ nice make subdirs=intl tests=tst-gettext3 check

This is a tests-special, you cannot do that.

Andreas.
  
Martin Sebor Oct. 13, 2015, 1:27 p.m. UTC | #3
On 10/13/2015 01:11 AM, Andreas Schwab wrote:
> Martin Sebor <msebor@gmail.com> writes:
>
>>    $ nice make subdirs=intl tests=tst-gettext3 check
>
> This is a tests-special, you cannot do that.

Right, I forgot about my own bug 19017 that aims to make this sort
of thing work.

Martin
  

Patch

diff --git a/debug/Makefile b/debug/Makefile
index 9ff357b..f871ba9 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -162,6 +162,13 @@  generated += catchsegv xtrace
 
 include ../Rules
 
+ifeq ($(run-built-tests),yes)
+LOCALES := de_DE.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)tst-chk1.out: $(gen-locales)
+endif
+
 sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
 
 $(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index a3d1d09..0cd6518 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -271,6 +271,14 @@  endif
 
 include ../Rules
 
+ifeq ($(run-built-tests),yes)
+LOCALES := de_DE.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)bug-iconv6.out: $(gen-locales)
+$(objpfx)tst-iconv7.out: $(gen-locales)
+endif
+
 # Set libof-* for each routine.
 cpp-srcs-left := $(modules) $(generated-modules) $(libJIS-routines) \
 		 $(libKSC-routines) $(libGB-routines) $(libCNS-routines) \
diff --git a/intl/Makefile b/intl/Makefile
index 9ecf8fe..6a28c8a 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -105,6 +105,19 @@  $(objpfx)tst-codeset.out: $(codeset_mo)
 $(objpfx)tst-gettext3.out: $(codeset_mo)
 $(objpfx)tst-gettext5.out: $(codeset_mo)
 endif
+
+LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 fr_FR.ISO-8859-1 \
+	   ja_JP.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)tst-codeset.out: $(gen-locales)
+$(objpfx)tst-gettext.out: $(gen-locales)
+$(objpfx)tst-gettext2.out: $(gen-locales)
+$(objpfx)tst-gettext3.out: $(gen-locales)
+$(objpfx)tst-gettext4.out: $(gen-locales)
+$(objpfx)tst-gettext5.out: $(gen-locales)
+$(objpfx)tst-gettext6.out: $(gen-locales)
+$(objpfx)tst-translit.out: $(gen-locales)
 endif
 
 $(objpfx)msgs.h: po2test.awk ../po/de.po
diff --git a/libio/Makefile b/libio/Makefile
index a1d1741..273c240 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -176,6 +176,30 @@  endif
 
 include ../Rules
 
+ifeq ($(run-built-tests),yes)
+LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
+	   ja_JP.EUC-JP ja_JP.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)bug-ftell.out: $(gen-locales)
+$(objpfx)bug-ungetwc1.out: $(gen-locales)
+$(objpfx)bug-ungetwc2.out: $(gen-locales)
+$(objpfx)tst-fgetwc.out: $(gen-locales)
+$(objpfx)tst-fgetws.out: $(gen-locales)
+$(objpfx)tst-fopenloc.out: $(gen-locales)
+$(objpfx)tst-fputws.out: $(gen-locales)
+$(objpfx)tst-fseek.out: $(gen-locales)
+$(objpfx)tst-ftell-active-handler.out: $(gen-locales)
+$(objpfx)tst-ftell-append.out: $(gen-locales)
+$(objpfx)tst-ftell-partial-wide.out: $(gen-locales)
+$(objpfx)tst-setvbuf1.out: $(gen-locales)
+$(objpfx)tst-swscanf.out: $(gen-locales)
+$(objpfx)tst-ungetwc1.out: $(gen-locales)
+$(objpfx)tst-ungetwc2.out: $(gen-locales)
+$(objpfx)tst-widetext.out: $(gen-locales)
+$(objpfx)tst_wprintf2.out: $(gen-locales)
+endif
+
 $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
 	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'	\
 	$(common-objpfx)libio/; \
diff --git a/libio/tst_wprintf2.c b/libio/tst_wprintf2.c
index be0f29f..dfff70f 100644
--- a/libio/tst_wprintf2.c
+++ b/libio/tst_wprintf2.c
@@ -26,7 +26,7 @@  main (int argc, char *argv[])
 
   unlink (name);
 
-  setlocale (LC_ALL, "");
+  setlocale (LC_ALL, "en_US.UTF-8");
 
   fp = fdopen (dup (fd), "w");
   if (fp == NULL)
diff --git a/posix/Makefile b/posix/Makefile
index 39423a9..cbc4bc6 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -148,6 +148,36 @@  $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
 		 '$(run-program-env)' '$(test-program-prefix-after-env)'; \
 	$(evaluate-test)
 endif
+
+LOCALES := cs_CZ.UTF-8 da_DK.ISO-8859-1 de_DE.ISO-8859-1 de_DE.UTF-8 \
+	   en_US.UTF-8 es_US.ISO-8859-1 es_US.UTF-8 ja_JP.EUC-JP tr_TR.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)bug-regex1.out: $(gen-locales)
+$(objpfx)bug-regex4.out: $(gen-locales)
+$(objpfx)bug-regex5.out: $(gen-locales)
+$(objpfx)bug-regex6.out: $(gen-locales)
+$(objpfx)bug-regex17.out: $(gen-locales)
+$(objpfx)bug-regex18.out: $(gen-locales)
+$(objpfx)bug-regex19.out: $(gen-locales)
+$(objpfx)bug-regex20.out: $(gen-locales)
+$(objpfx)bug-regex22.out: $(gen-locales)
+$(objpfx)bug-regex23.out: $(gen-locales)
+$(objpfx)bug-regex25.out: $(gen-locales)
+$(objpfx)bug-regex26.out: $(gen-locales)
+$(objpfx)bug-regex30.out: $(gen-locales)
+$(objpfx)bug-regex32.out: $(gen-locales)
+$(objpfx)bug-regex33.out: $(gen-locales)
+$(objpfx)bug-regex34.out: $(gen-locales)
+$(objpfx)bug-regex35.out: $(gen-locales)
+$(objpfx)tst-fnmatch.out: $(gen-locales)
+$(objpfx)tst-fnmatch4.out: $(gen-locales)
+$(objpfx)tst-fnmatch5.out: $(gen-locales)
+$(objpfx)tst-regex.out: $(gen-locales)
+$(objpfx)tst-regex2.out: $(gen-locales)
+$(objpfx)tst-regexloc.out: $(gen-locales)
+$(objpfx)tst-rxspencer.out: $(gen-locales)
+$(objpfx)tst-rxspencer-no-utf8.out: $(gen-locales)
 endif
 
 # If we will use the generic uname implementation, we must figure out what
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index df4122d..d92d9d1 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -72,6 +72,19 @@  endif
 
 include ../Rules
 
+ifeq ($(run-built-tests),yes)
+LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 ja_JP.EUC-JP
+include ../gen-locales.mk
+
+$(objpfx)bug14.out: $(gen-locales)
+$(objpfx)scanf13.out: $(gen-locales)
+$(objpfx)test-vfprintf.out: $(gen-locales)
+$(objpfx)tst-grouping.out: $(gen-locales)
+$(objpfx)tst-sprintf.out: $(gen-locales)
+$(objpfx)tst-sscanf.out: $(gen-locales)
+$(objpfx)tst-swprintf.out: $(gen-locales)
+endif
+
 tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace
 
 $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 402466a..9e0c249 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -121,6 +121,18 @@  endif
 
 include ../Rules
 
+ifeq ($(run-built-tests),yes)
+LOCALES := cs_CZ.UTF-8 de_DE.UTF-8 en_US.ISO-8859-1 tr_TR.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)bug-strtod2.out: $(gen-locales)
+$(objpfx)testmb2.out: $(gen-locales)
+$(objpfx)tst-strtod.out: $(gen-locales)
+$(objpfx)tst-strtod3.out: $(gen-locales)
+$(objpfx)tst-strtod4.out: $(gen-locales)
+$(objpfx)tst-strtod5.out: $(gen-locales)
+endif
+
 # Testdir has to be named stdlib and needs to be writable
 test-canon-ARGS = --test-dir=${common-objpfx}stdlib
 
diff --git a/time/Makefile b/time/Makefile
index a411f62..933e70e 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -41,6 +41,14 @@  tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
 
 include ../Rules
 
+ifeq ($(run-built-tests),yes)
+LOCALES := de_DE.ISO-8859-1 en_US.ISO-8859-1 ja_JP.EUC-JP
+include ../gen-locales.mk
+
+$(objpfx)tst-ftime_l.out: $(gen-locales)
+$(objpfx)tst-strptime.out: $(gen-locales)
+endif
+
 tz-cflags = -DTZDIR='"$(zonedir)"' \
 	    -DTZDEFAULT='"$(localtime-file)"' \
 	    -DTZDEFRULES='"$(posixrules-file)"'
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index dc72ba4..a59a005 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -51,6 +51,19 @@  tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
 
 include ../Rules
 
+ifeq ($(run-built-tests),yes)
+LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 hr_HR.ISO-8859-2 \
+	   ja_JP.EUC-JP zh_TW.EUC-TW
+include ../gen-locales.mk
+
+$(objpfx)tst-btowc.out: $(gen-locales)
+$(objpfx)tst-c16c32-1.out: $(gen-locales)
+$(objpfx)tst-mbrtowc.out: $(gen-locales)
+$(objpfx)tst-mbrtowc2.out: $(gen-locales)
+$(objpfx)tst-wcrtomb.out: $(gen-locales)
+$(objpfx)wcsmbs-tst1.out: $(gen-locales)
+endif
+
 CFLAGS-wcwidth.c = -I../wctype
 CFLAGS-wcswidth.c = -I../wctype
 
diff --git a/wcsmbs/wcsmbs-tst1.c b/wcsmbs/wcsmbs-tst1.c
index 9cdef45..0d0e18f 100644
--- a/wcsmbs/wcsmbs-tst1.c
+++ b/wcsmbs/wcsmbs-tst1.c
@@ -18,7 +18,7 @@  main (void)
   char str[] = "Hello";
   int result = 0;
 
-  pchar = setlocale (LC_ALL, "");
+  pchar = setlocale (LC_ALL, "de_DE.UTF-8");
   printf ("locale : %s\n",pchar);
   printf ("MB_CUR_MAX %Zd\n", MB_CUR_MAX);