about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog87
-rw-r--r--INSTALL15
-rw-r--r--Makeconfig45
-rw-r--r--Rules3
-rw-r--r--benchtests/Makefile2
-rw-r--r--catgets/Makefile17
-rwxr-xr-xcatgets/test-gencat.sh11
-rw-r--r--elf/Makefile3
-rwxr-xr-xelf/tst-pathopt.sh5
-rw-r--r--iconvdata/Makefile3
-rwxr-xr-xiconvdata/run-iconv-test.sh10
-rwxr-xr-xiconvdata/tst-table.sh3
-rw-r--r--intl/Makefile6
-rwxr-xr-xintl/tst-gettext.sh23
-rw-r--r--intl/tst-gettext2.sh19
-rwxr-xr-xintl/tst-gettext4.sh8
-rw-r--r--intl/tst-gettext6.sh8
-rwxr-xr-xintl/tst-translit.sh8
-rw-r--r--localedata/ChangeLog42
-rw-r--r--localedata/Makefile33
-rw-r--r--localedata/gen-locale.sh10
-rw-r--r--localedata/sort-test.sh14
-rwxr-xr-xlocaledata/tst-ctype.sh9
-rwxr-xr-xlocaledata/tst-fmon.sh17
-rwxr-xr-xlocaledata/tst-langinfo.sh9
-rwxr-xr-xlocaledata/tst-locale.sh11
-rwxr-xr-xlocaledata/tst-mbswcs.sh5
-rw-r--r--localedata/tst-numeric.sh4
-rwxr-xr-xlocaledata/tst-rpmatch.sh2
-rwxr-xr-xlocaledata/tst-trans.sh18
-rwxr-xr-xlocaledata/tst-wctype.sh9
-rw-r--r--malloc/Makefile3
-rwxr-xr-xmalloc/tst-mtrace.sh9
-rw-r--r--manual/install.texi8
-rw-r--r--math/Makefile2
-rw-r--r--nptl/Makefile2
-rwxr-xr-xnptl/tst-tls6.sh11
-rw-r--r--posix/Makefile3
-rw-r--r--posix/tst-getconf.sh6
-rwxr-xr-xposix/wordexp-tst.sh34
-rwxr-xr-xscripts/cross-test-ssh.sh45
-rw-r--r--stdio-common/tst-printf.sh1
-rw-r--r--stdlib/Makefile4
-rwxr-xr-xstdlib/tst-fmtmsg.sh76
-rw-r--r--timezone/Makefile4
45 files changed, 419 insertions, 248 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b1f398c39..4baa8455ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,90 @@
+2014-06-06  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makeconfig (run-program-env): New variable.
+	(run-program-prefix-before-env): Likewise.
+	(run-program-prefix-after-env): Likewise.
+	(run-program-prefix): Define in terms of new variables.
+	(built-program-cmd-before-env): New variable.
+	(built-program-cmd-after-env): Likewise.
+	(built-program-cmd): Define in terms of new variables.
+	(test-program-prefix-before-env): New variable.
+	(test-program-prefix-after-env): Likewise.
+	(test-program-prefix): Define in terms of new variables.
+	(test-program-cmd-before-env): New variable.
+	(test-program-cmd-after-env): Likewise.
+	(test-program-cmd): Define in terms of new variables.
+	* Rules (make-test-out): Use $(run-program-env).
+	* scripts/cross-test-ssh.sh (env_blacklist): Remove variable.
+	(help): Do not mention environment variables.  Mention
+	--timeoutfactor option.
+	(timeoutfactor): New variable.
+	(blacklist_exports): Remove function.
+	(exports): Remove variable.
+	(command): Do not include ${exports}.
+	* manual/install.texi (Configuring and compiling): Do not mention
+	test wrappers preserving environment variables.  Mention that last
+	assignment to a variable must take precedence.
+	* INSTALL: Regenerated.
+	* benchtests/Makefile (run-bench): Use $(run-program-env).
+	* catgets/Makefile ($(objpfx)test1.cat): Use
+	$(built-program-cmd-before-env), $(run-program-env) and
+	$(built-program-cmd-after-env).
+	($(objpfx)test2.cat): Do not specify environment variables
+	explicitly.
+	($(objpfx)de/libc.cat): Use $(built-program-cmd-before-env),
+	$(run-program-env) and $(built-program-cmd-after-env).
+	($(objpfx)test-gencat.out): Use $(test-program-cmd-before-env),
+	$(run-program-env) and $(test-program-cmd-after-env).
+	($(objpfx)sample.SJIS.cat): Do not specify environment variables
+	explicitly.
+	* catgets/test-gencat.sh: Use test_program_cmd_before_env,
+	run_program_env and test_program_cmd_after_env arguments.
+	* elf/Makefile ($(objpfx)tst-pathopt.out): Use $(run-program-env).
+	* elf/tst-pathopt.sh: Use run_program_env argument.
+	* iconvdata/Makefile ($(objpfx)iconv-test.out): Use
+	$(test-wrapper-env) and $(run-program-env).
+	* iconvdata/run-iconv-test.sh: Use test_wrapper_env and
+	run_program_env arguments.
+	* iconvdata/tst-table.sh: Do not set GCONV_PATH explicitly.
+	* intl/Makefile ($(objpfx)tst-gettext.out): Use
+	$(test-program-prefix-before-env), $(run-program-env) and
+	$(test-program-prefix-after-env).
+	($(objpfx)tst-gettext2.out): Likewise.
+	* intl/tst-gettext.sh: Use test_program_prefix_before_env,
+	run_program_env and test_program_prefix_after_env arguments.
+	* intl/tst-gettext2.sh: Likewise.
+	* intl/tst-gettext4.sh: Do not set environment variables
+	explicitly.
+	* intl/tst-gettext6.sh: Likewise.
+	* intl/tst-translit.sh: Likewise.
+	* malloc/Makefile ($(objpfx)tst-mtrace.out): Use
+	$(test-program-prefix-before-env), $(run-program-env) and
+	$(test-program-prefix-after-env).
+	* malloc/tst-mtrace.sh: Use test_program_prefix_before_env,
+	run_program_env and test_program_prefix_after_env arguments.
+	* math/Makefile (run-regen-ulps): Use $(run-program-env).
+	* nptl/Makefile ($(objpfx)tst-tls6.out): Use $(run-program-env).
+	* nptl/tst-tls6.sh: Use run_program_env argument.  Set LANG=C
+	explicitly with each use of ${test_wrapper_env}.
+	* posix/Makefile ($(objpfx)wordexp-tst.out): Use
+	$(test-program-prefix-before-env), $(run-program-env) and
+	$(test-program-prefix-after-env).
+	* posix/tst-getconf.sh: Do not set environment variables
+	explicitly.
+	* posix/wordexp-tst.sh: Use test_program_prefix_before_env,
+	run_program_env and test_program_prefix_after_env arguments.
+	* stdio-common/tst-printf.sh: Do not set environment variables
+	explicitly.
+	* stdlib/Makefile ($(objpfx)tst-fmtmsg.out): Use
+	$(test-program-prefix-before-env), $(run-program-env) and
+	$(test-program-prefix-after-env).
+	* stdlib/tst-fmtmsg.sh: Use test_program_prefix_before_env,
+	run_program_env and test_program_prefix_after_env arguments.
+	Split $test calls into $test_pre and $test.
+	* timezone/Makefile (build-testdata): Use
+	$(built-program-cmd-before-env), $(run-program-env) and
+	$(built-program-cmd-after-env).
+
 2014-06-06  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/powerpc64/power7/strncat.S [STRLEN]: Define it as
diff --git a/INSTALL b/INSTALL
index f49fad4caf..63630b8bbe 100644
--- a/INSTALL
+++ b/INSTALL
@@ -241,13 +241,14 @@ be visible at the same locations on both the build system and HOSTNAME.
    In general, when testing the GNU C Library, `test-wrapper' may be set
 to the name and arguments of any program to run newly built binaries.
 This program must preserve the arguments to the binary being run, its
-working directory, all environment variables set as part of testing and
-the standard input, output and error file descriptors.  If
-`TEST-WRAPPER env' will not work to run a program with environment
-variables set, then `test-wrapper-env' must be set to a program that
-runs a newly built program with environment variable assignments in
-effect, those assignments being specified as `VAR=VALUE' before the
-name of the program to be run.
+working directory and the standard input, output and error file
+descriptors.  If `TEST-WRAPPER env' will not work to run a program with
+environment variables set, then `test-wrapper-env' must be set to a
+program that runs a newly built program with environment variable
+assignments in effect, those assignments being specified as `VAR=VALUE'
+before the name of the program to be run.  If multiple assignments to
+the same variable are specified, the last assignment specified must
+take precedence.
 
 Installing the C Library
 ========================
diff --git a/Makeconfig b/Makeconfig
index 736190bc10..e07823f1bd 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -628,17 +628,30 @@ run-via-rtld-prefix =							      \
 else
 run-via-rtld-prefix =
 endif
+# $(run-program-env) is the default environment variable settings to
+# use when running a program built with the newly built library.
+run-program-env = GCONV_PATH=$(common-objpfx)iconvdata \
+		  LOCPATH=$(common-objpfx)localedata LC_ALL=C
 # $(run-program-prefix) is a command that, when prepended to the name
 # of a program built with the newly built library, produces a command
 # that, executed on the build system on which "make" is run, runs that
-# program.
-run-program-prefix = $(test-wrapper) $(run-via-rtld-prefix)
+# program.  $(run-program-prefix-before-env) and
+# $(run-program-prefix-after-env) are similar, but separate parts
+# before and after a list of environment variables.
+run-program-prefix-before-env = $(test-wrapper-env)
+run-program-prefix-after-env = $(run-via-rtld-prefix)
+run-program-prefix = $(run-program-prefix-before-env) $(run-program-env) \
+		     $(run-program-prefix-after-env)
 # $(built-program-cmd) is a command that, executed on the build system
 # on which "make" is run, runs the newly built program that is the
 # second dependency of the makefile target in which
-# $(built-program-cmd) is used.
-built-program-cmd = $(test-wrapper) \
-		    $(run-via-rtld-prefix) $(built-program-file)
+# $(built-program-cmd) is used.  $(built-program-cmd-before-env) and
+# $(built-program-cmd-after-env) are similar, before and after a list
+# of environment variables.
+built-program-cmd-before-env = $(test-wrapper-env)
+built-program-cmd-after-env = $(run-via-rtld-prefix) $(built-program-file)
+built-program-cmd = $(built-program-cmd-before-env) $(run-program-env) \
+		    $(built-program-cmd-after-env)
 # $(host-built-program-cmd) is a command that, executed on the host
 # for which the library is built, runs the newly built program that is
 # the second dependency of the makefile target in which
@@ -659,12 +672,16 @@ endif
 # $(test-program-prefix) is a command that, when prepended to the name
 # of a test program built with the newly built library, produces a command
 # that, executed on the build system on which "make" is run, runs that
-# test program.
+# test program.  $(test-program-prefix-before-env) and
+# $(test-program-prefix-after-env) are similar, before and after a
+# list of environment variables.
 
 # $(test-program-cmd) is a command that, executed on the build system
 # on which "make" is run, runs the newly built test program that is the
 # second dependency of the makefile target in which
-# $(test-program-cmd) is used.
+# $(test-program-cmd) is used.  $(test-program-cmd-before-env) and
+# $(test-program-cmd-after-env) are similar, before and after a list
+# of environment variables.
 
 # $(host-test-program-cmd) is a command that, executed on the host
 # for which the library is built, runs the newly built test program that
@@ -673,12 +690,22 @@ endif
 
 ifeq (yes,$(build-hardcoded-path-in-tests))
 test-via-rtld-prefix =
-test-program-prefix = $(test-wrapper)
-test-program-cmd = $(test-wrapper) $(built-program-file)
+test-program-prefix-before-env = $(test-wrapper-env)
+test-program-prefix-after-env =
+test-program-prefix = $(test-program-prefix-before-env) $(run-program-env) \
+		      $(test-program-prefix-after-env)
+test-program-cmd-before-env = $(test-wrapper-env)
+test-program-cmd-after-env = $(built-program-file)
+test-program-cmd = $(test-program-cmd-before-env) $(run-program-env) \
+		   $(test-program-cmd-after-env)
 host-test-program-cmd = $(built-program-file)
 else
 test-via-rtld-prefix = $(run-via-rtld-prefix)
+test-program-prefix-before-env = $(run-program-prefix-before-env)
+test-program-prefix-after-env = $(run-program-prefix-after-env)
 test-program-prefix = $(run-program-prefix)
+test-program-cmd-before-env = $(built-program-cmd-before-env)
+test-program-cmd-after-env = $(built-program-cmd-after-env)
 test-program-cmd = $(built-program-cmd)
 host-test-program-cmd = $(host-built-program-cmd)
 endif
diff --git a/Rules b/Rules
index 9f1a445ea7..4f9cdf30e6 100644
--- a/Rules
+++ b/Rules
@@ -191,8 +191,7 @@ ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
 # from the test programs and whatever input files are present.
 
 make-test-out = $(test-wrapper-env) \
-		GCONV_PATH=$(common-objpfx)iconvdata \
-		LOCPATH=$(common-objpfx)localedata LC_ALL=C \
+		$(run-program-env) \
 		$($*-ENV) $(host-test-program-cmd) $($*-ARGS)
 $(objpfx)%.out: %.input $(objpfx)%
 	$(make-test-out) > $@ < $(word 1,$^); \
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 63a5a7fd6b..fbcee1328b 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -91,7 +91,7 @@ extra-objs += json-lib.o
 bench-deps := bench-skeleton.c bench-timing.h Makefile
 
 run-bench = $(test-wrapper-env) \
-	    GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+	    $(run-program-env) \
 	    $($*-ENV) $(rtld-prefix) $${run}
 
 timing-type := $(objpfx)bench-timing-type
diff --git a/catgets/Makefile b/catgets/Makefile
index ed0650807b..50d972e65d 100644
--- a/catgets/Makefile
+++ b/catgets/Makefile
@@ -61,19 +61,18 @@ ifeq ($(run-built-tests),yes)
 # This test just checks whether the program produces any error or not.
 # The result is not tested.
 $(objpfx)test1.cat: test1.msg $(objpfx)gencat
-	LC_ALL=hr_HR.ISO-8859-2 LOCPATH=$(common-objpfx)localedata \
-	GCONV_PATH=$(common-objpfx)iconvdata \
-	$(built-program-cmd) -H $(objpfx)test1.h $@ $<; \
+	$(built-program-cmd-before-env) \
+	$(run-program-env) LC_ALL=hr_HR.ISO-8859-2 \
+	$(built-program-cmd-after-env) -H $(objpfx)test1.h $@ $<; \
 	$(evaluate-test)
 $(objpfx)test2.cat: test2.msg $(objpfx)gencat
-	LOCPATH=$(common-objpfx)localedata \
-	GCONV_PATH=$(common-objpfx)iconvdata \
 	$(built-program-cmd) -H $(objpfx)test2.h $@ $<; \
 	$(evaluate-test)
 $(objpfx)de/libc.cat: $(objpfx)de.msg $(objpfx)gencat
 	$(make-target-directory)
-	LC_ALL=de_DE.ISO-8859-1 LOCPATH=$(common-objpfx)localedata \
-	GCONV_PATH=$(common-objpfx)iconvdata $(built-program-cmd) $@ $<; \
+	$(built-program-cmd-before-env) \
+	$(run-program-env) LC_ALL=de_DE.ISO-8859-1 \
+	$(built-program-cmd-after-env) $@ $<; \
 	$(evaluate-test)
 $(objpfx)tst-catgets.out: $(objpfx)de/libc.cat
 
@@ -83,11 +82,11 @@ $(objpfx)de.msg: xopen-msg.awk $(..)po/de.po
 
 $(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
 			  $(objpfx)sample.SJIS.cat
-	$(SHELL) $< $(common-objpfx) '$(test-program-cmd)'; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+		 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
 	$(evaluate-test)
 
 $(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
-	GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
 	$(built-program-cmd) -H $(objpfx)test-gencat.h < $(word 1,$^) > $@; \
 	$(evaluate-test)
 endif
diff --git a/catgets/test-gencat.sh b/catgets/test-gencat.sh
index 08e47af24a..98ef7da6ef 100755
--- a/catgets/test-gencat.sh
+++ b/catgets/test-gencat.sh
@@ -20,12 +20,15 @@
 set -e
 
 common_objpfx=$1
-test_program_cmd=$2
+test_program_cmd_before_env=$2
+run_program_env=$3
+test_program_cmd_after_env=$4
 
 # Run the test program.
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-NLSPATH=${common_objpfx}catgets/%N.%c.cat LC_ALL=ja_JP.SJIS \
-  ${test_program_cmd} \
+${test_program_cmd_before_env} \
+  ${run_program_env} \
+  NLSPATH=${common_objpfx}catgets/%N.%c.cat LC_ALL=ja_JP.SJIS \
+  ${test_program_cmd_after_env} \
     > ${common_objpfx}catgets/test-gencat.out
 
 # Compare with the expected result.
diff --git a/elf/Makefile b/elf/Makefile
index 4dcc78a163..eb16c5998c 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -711,7 +711,8 @@ $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
 $(objpfx)tst-pathopt: $(libdl)
 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
 			  $(objpfx)pathoptobj.so
-	$(SHELL) $< $(common-objpfx) '$(test-wrapper-env)'; \
+	$(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
+		 '$(run-program-env)'; \
 	$(evaluate-test)
 
 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
diff --git a/elf/tst-pathopt.sh b/elf/tst-pathopt.sh
index 9677cf0ae8..24f55c0361 100755
--- a/elf/tst-pathopt.sh
+++ b/elf/tst-pathopt.sh
@@ -21,6 +21,7 @@ set -e
 
 common_objpfx=$1
 test_wrapper_env=$2
+run_program_env=$3
 
 test -e ${common_objpfx}elf/will-be-empty &&
   rm -fr ${common_objpfx}elf/will-be-empty
@@ -30,8 +31,8 @@ test -d ${common_objpfx}elf/for-renamed ||
 cp ${common_objpfx}elf/pathoptobj.so ${common_objpfx}elf/for-renamed/renamed.so
 
 ${test_wrapper_env} \
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=C LD_LIBRARY_PATH=${common_objpfx}elf/will-be-empty:${common_objpfx}elf/for-renamed:${common_objpfx}.:${common_objpfx}dlfcn \
+${run_program_env} \
+LD_LIBRARY_PATH=${common_objpfx}elf/will-be-empty:${common_objpfx}elf/for-renamed:${common_objpfx}.:${common_objpfx}dlfcn \
   ${common_objpfx}elf/ld.so ${common_objpfx}elf/tst-pathopt \
     > ${common_objpfx}elf/tst-pathopt.out
 
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index d98b6bd2e9..8fb746e1d5 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -297,7 +297,8 @@ $(objpfx)tst-iconv7.out: $(objpfx)gconv-modules \
 $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
 			 $(addprefix $(objpfx),$(modules.so)) \
 			 $(common-objdir)/iconv/iconv_prog TESTS
-	$(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@; \
+	$(SHELL) $< $(common-objdir) '$(test-wrapper-env)' \
+		 '$(run-program-env)' > $@; \
 	$(evaluate-test)
 
 $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
diff --git a/iconvdata/run-iconv-test.sh b/iconvdata/run-iconv-test.sh
index e23f60d442..c98c92950d 100755
--- a/iconvdata/run-iconv-test.sh
+++ b/iconvdata/run-iconv-test.sh
@@ -21,7 +21,8 @@
 set -e
 
 codir=$1
-test_wrapper="$2"
+test_wrapper_env="$2"
+run_program_env="$3"
 
 # We use always the same temporary file.
 temp1=$codir/iconvdata/iconv-test.xxx
@@ -29,18 +30,13 @@ temp2=$codir/iconvdata/iconv-test.yyy
 
 trap "rm -f $temp1 $temp2" 1 2 3 15
 
-# We must tell the iconv(1) program where the modules we want to use can
-# be found.
-GCONV_PATH=$codir/iconvdata
-export GCONV_PATH
-
 # We have to have some directories in the library path.
 LIBPATH=$codir:$codir/iconvdata
 
 # How the start the iconv(1) program.
 ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
        $codir/iconv/iconv_prog'
-ICONV="$test_wrapper $ICONV"
+ICONV="$test_wrapper_env $run_program_env $ICONV"
 
 # Which echo?
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
diff --git a/iconvdata/tst-table.sh b/iconvdata/tst-table.sh
index c68a3b9f01..838f332794 100755
--- a/iconvdata/tst-table.sh
+++ b/iconvdata/tst-table.sh
@@ -27,8 +27,7 @@ test_program_prefix=$3
 charset=$4
 charmap=$5
 
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
+# sort is used on the build system.
 LC_ALL=C
 export LC_ALL
 
diff --git a/intl/Makefile b/intl/Makefile
index 10051f6871..a04643128a 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -81,7 +81,8 @@ $(objpfx)mtrace-tst-gettext.out: $(objpfx)tst-gettext.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@; \
 	$(evaluate-test)
 $(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
-	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
+	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+	  '$(run-program-env)' '$(test-program-prefix-after-env)' \
 	  $(common-objpfx)intl/ $(objpfx)tst-gettext.mtrace; \
 	$(evaluate-test)
 $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
@@ -89,7 +90,8 @@ $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
 	  $(common-objpfx)intl/; \
 	$(evaluate-test)
 $(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
-	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
+	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+	  '$(run-program-env)' '$(test-program-prefix-after-env)' \
 	  $(common-objpfx)intl/; \
 	$(evaluate-test)
 $(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
diff --git a/intl/tst-gettext.sh b/intl/tst-gettext.sh
index 0483e2bbcd..129ce65a61 100755
--- a/intl/tst-gettext.sh
+++ b/intl/tst-gettext.sh
@@ -20,12 +20,11 @@
 set -e
 
 common_objpfx=$1
-test_program_prefix=$2
-objpfx=$3
-malloc_trace=$4
-
-LC_ALL=C
-export LC_ALL
+test_program_prefix_before_env=$2
+run_program_env=$3
+test_program_prefix_after_env=$4
+objpfx=$5
+malloc_trace=$6
 
 # Generate the test data.
 
@@ -47,14 +46,12 @@ msgfmt -o ${objpfx}domaindir/existing-locale/LC_MESSAGES/existing-domain.mo \
 msgfmt -o ${objpfx}domaindir/existing-locale/LC_TIME/existing-time-domain.mo \
        -f ../po/de.po
 
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
 # Now run the test.
-MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
-${test_program_prefix} \
+${test_program_prefix_before_env} \
+${run_program_env} \
+MALLOC_TRACE=$malloc_trace \
+LOCPATH=${objpfx}localedir:${common_objpfx}localedata \
+${test_program_prefix_after_env} \
 ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
 
 exit $?
diff --git a/intl/tst-gettext2.sh b/intl/tst-gettext2.sh
index 44821d2d15..b4d203d667 100644
--- a/intl/tst-gettext2.sh
+++ b/intl/tst-gettext2.sh
@@ -20,11 +20,10 @@
 set -e
 
 common_objpfx=$1
-test_program_prefix=$2
-objpfx=$3
-
-LC_ALL=C
-export LC_ALL
+test_program_prefix_before_env=$2
+run_program_env=$3
+test_program_prefix_after_env=$4
+objpfx=$5
 
 # Generate the test data.
 mkdir -p ${objpfx}domaindir
@@ -61,13 +60,11 @@ msgfmt -o ${objpfx}domaindir/lang1/LC_MESSAGES/tstlang.mo \
 msgfmt -o ${objpfx}domaindir/lang2/LC_MESSAGES/tstlang.mo \
        tstlang2.po
 
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${objpfx}domaindir
-export LOCPATH
-
 # Now run the test.
-${test_program_prefix} \
+${test_program_prefix_before_env} \
+${run_program_env} \
+LOCPATH=${objpfx}domaindir \
+${test_program_prefix_after_env} \
 ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
 cmp ${objpfx}tst-gettext2.out - <<EOF
 String1 - Lang1: 1st string
diff --git a/intl/tst-gettext4.sh b/intl/tst-gettext4.sh
index fc975df28f..4039fafaa5 100755
--- a/intl/tst-gettext4.sh
+++ b/intl/tst-gettext4.sh
@@ -24,9 +24,6 @@ common_objpfx=$1
 test_program_prefix=$2
 objpfx=$3
 
-LC_ALL=C
-export LC_ALL
-
 # Create the domain directories.
 mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
 mkdir -p ${objpfx}domaindir/fr_FR/LC_MESSAGES
@@ -34,11 +31,6 @@ mkdir -p ${objpfx}domaindir/fr_FR/LC_MESSAGES
 msgfmt -o ${objpfx}domaindir/de_DE/LC_MESSAGES/multithread.mo tst-gettext4-de.po
 msgfmt -o ${objpfx}domaindir/fr_FR/LC_MESSAGES/multithread.mo tst-gettext4-fr.po
 
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
 ${test_program_prefix} ${objpfx}tst-gettext4 > ${objpfx}tst-gettext4.out
 
 exit $?
diff --git a/intl/tst-gettext6.sh b/intl/tst-gettext6.sh
index 70cbcbea52..be95ffc802 100644
--- a/intl/tst-gettext6.sh
+++ b/intl/tst-gettext6.sh
@@ -23,19 +23,11 @@ common_objpfx=$1
 test_program_prefix=$2
 objpfx=$3
 
-LC_ALL=C
-export LC_ALL
-
 # Create the domain directory.
 mkdir -p ${objpfx}domaindir/ja_JP/LC_MESSAGES
 # Populate it.
 msgfmt -o ${objpfx}domaindir/ja_JP/LC_MESSAGES/tstgettext6.mo ../po/ja.po
 
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
 ${test_program_prefix} ${objpfx}tst-gettext6 > ${objpfx}tst-gettext6.out
 
 exit $?
diff --git a/intl/tst-translit.sh b/intl/tst-translit.sh
index 4803340de0..3408b1a767 100755
--- a/intl/tst-translit.sh
+++ b/intl/tst-translit.sh
@@ -23,20 +23,12 @@ common_objpfx=$1
 test_program_prefix=$2
 objpfx=$3
 
-LC_ALL=C
-export LC_ALL
-
 # Create the locale directories.
 mkdir -p ${objpfx}localedir/existing-locale/LC_MESSAGES
 
 msgfmt -o ${objpfx}domaindir/existing-locale/LC_MESSAGES/translit.mo \
        translit.po
 
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
 ${test_program_prefix} \
 ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
 
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 134af04c99..7d91d38314 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,45 @@
+2014-06-06  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile ($(addprefix $(objpfx),$(CTYPE_FILES))): Use
+	$(built-program-cmd-before-env), $(run-program-env) and
+	$(built-program-cmd-after-env).
+	($(objpfx)sort-test.out): Use $(test-program-prefix-before-env),
+	$(run-program-env) and $(test-program-prefix-after-env).
+	($(objpfx)tst-fmon.out): Use $(run-program-prefix-before-env),
+	$(run-program-env) and $(run-program-prefix-after-env).
+	($(objpfx)tst-locale.out): Use $(built-program-cmd-before-env),
+	$(run-program-env) and $(built-program-cmd-after-env).
+	($(objpfx)tst-trans.out): Use $(run-program-prefix-before-env),
+	$(run-program-env), $(run-program-prefix-after-env),
+	$(test-program-prefix-before-env) and
+	$(test-program-prefix-after-env).
+	($(objpfx)tst-ctype.out): Use $(test-program-cmd-before-env),
+	$(run-program-env) and $(test-program-cmd-after-env).
+	($(objpfx)tst-wctype.out): Likewise.
+	($(objpfx)tst-langinfo.out): Likewise.
+	($(objpfx)tst-langinfo-static.out): Likewise.
+	* gen-locale.sh: Use localedef_before_env, run_program_env and
+	localedef_after_env arguments.
+	* sort-test.sh: Use test_program_prefix_before_env,
+	run_program_env and test_program_prefix_after_env arguments.
+	* tst-ctype.sh: Use tst_ctype_before_env, run_program_env and
+	tst_ctype_after_env arguments.
+	* tst-fmon.sh: Use run_program_prefix_before_env, run_program_env
+	and run_program_prefix_after_env arguments.
+	* tst-langinfo.sh: Use tst_langinfo_before_env, run_program_env
+	and tst_langinfo_after_env arguments.
+	* tst-locale.sh: Use localedef_before_env, run_program_env and
+	localedef_after_env arguments.
+	* tst-mbswcs.sh: Do not set environment variables explicitly.
+	* tst-numeric.sh: Likewise.
+	* tst-rpmatch.sh: Likewise.
+	* tst-trans.sh: Use run_program_prefix_before_env,
+	run_program_env, run_program_prefix_after_env,
+	test_program_prefix_before_env and test_program_prefix_after_env
+	arguments.
+	* tst-wctype.sh: Use tst_wctype_before_env, run_program_env and
+	tst_wctype_after_env arguments.
+
 2014-06-05  Andreas Schwab  <schwab@suse.de>
 
 	[BZ #16095]
diff --git a/localedata/Makefile b/localedata/Makefile
index 20da00cf16..6dc25244e1 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -143,7 +143,9 @@ generated-dirs += $(LOCALES)
 $(addprefix $(objpfx),$(CTYPE_FILES)): %: \
   gen-locale.sh $(common-objpfx)locale/localedef Makefile \
   $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
-	@$(SHELL) gen-locale.sh $(common-objpfx) '$(built-program-cmd)' $@; \
+	@$(SHELL) gen-locale.sh $(common-objpfx) \
+		  '$(built-program-cmd-before-env)' '$(run-program-env)' \
+		  '$(built-program-cmd-after-env)' $@; \
 	$(evaluate-test)
 
 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
@@ -151,14 +153,17 @@ $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
 
 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
 		       $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(test-input) \
+	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+	  '$(run-program-env)' '$(test-program-prefix-after-env)' \
+	  $(test-input) \
 	  > $@; \
 	$(evaluate-test)
 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
 		       $(objpfx)sort-test.out \
 		       $(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
-		'$(test-program-prefix)' tst-fmon.data  \
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
+		 '$(run-program-env)' '$(run-program-prefix-after-env)' \
+		 '$(test-program-prefix)' tst-fmon.data \
 	  > $@; \
 	$(evaluate-test)
 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
@@ -169,7 +174,8 @@ $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
 	$(evaluate-test)
 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
 			 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@; \
+	$(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
+		 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
 	$(evaluate-test)
 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
 			  $(objpfx)tst-fmon.out \
@@ -178,7 +184,10 @@ $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
 	$(evaluate-test)
 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
 			$(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' '$(test-program-prefix)'; \
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
+		 '$(run-program-env)' '$(run-program-prefix-after-env)' \
+		 '$(test-program-prefix-before-env)' \
+		 '$(test-program-prefix-after-env)'; \
 	$(evaluate-test)
 $(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
 			 $(objpfx)tst-mbswcs2 $(objpfx)tst-mbswcs3 \
@@ -189,22 +198,26 @@ $(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
 			$(objpfx)sort-test.out \
 			$(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(test-program-cmd)'; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+		 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
 	$(evaluate-test)
 $(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
 			$(objpfx)sort-test.out tst-wctype.input \
 			$(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(test-program-cmd)'; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+		 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
 	$(evaluate-test)
 $(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
 			$(objpfx)sort-test.out \
 			$(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+		 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
 	$(evaluate-test)
 $(objpfx)tst-langinfo-static.out: tst-langinfo.sh $(objpfx)tst-langinfo-static \
 			$(objpfx)sort-test.out \
 			$(addprefix $(objpfx),$(CTYPE_FILES))
-	$(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+		 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
 	$(evaluate-test)
 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
diff --git a/localedata/gen-locale.sh b/localedata/gen-locale.sh
index d2fde61e32..151634ba14 100644
--- a/localedata/gen-locale.sh
+++ b/localedata/gen-locale.sh
@@ -20,7 +20,9 @@
 set -e
 
 common_objpfx="$1"; shift
-localedef="$1"; shift
+localedef_before_env="$1"; shift
+run_program_env="$1"; shift
+localedef_after_env="$1"; shift
 locfile="$1"; shift
 
 generate_locale ()
@@ -28,9 +30,9 @@ generate_locale ()
   charmap=$1
   input=$2
   out=$3
-  if I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
-     ${localedef} --quiet -c -f $charmap -i $input \
-		  ${common_objpfx}localedata/$out
+  if ${localedef_before_env} ${run_program_env} I18NPATH=. \
+     ${localedef_after_env} --quiet -c -f $charmap -i $input \
+			    ${common_objpfx}localedata/$out
   then
     # The makefile checks the timestamp of the LC_CTYPE file,
     # but localedef won't have touched it if it was able to
diff --git a/localedata/sort-test.sh b/localedata/sort-test.sh
index 8a7ca89688..e37129a032 100644
--- a/localedata/sort-test.sh
+++ b/localedata/sort-test.sh
@@ -20,7 +20,9 @@
 set -e
 
 common_objpfx=$1; shift
-test_program_prefix=$1; shift
+test_program_prefix_before_env=$1; shift
+run_program_env=$1; shift
+test_program_prefix_after_env=$1; shift
 lang=$*
 
 id=${PPID:-100}
@@ -31,8 +33,9 @@ status=0
 for l in $lang; do
   here=0
   cns=`echo $l | sed 's/\(.*\)[.][^.]*/\1/'`
-  LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
-   LC_ALL=$l ${test_program_prefix} \
+  ${test_program_prefix_before_env} \
+   ${run_program_env} \
+   LC_ALL=$l ${test_program_prefix_after_env} \
    ${common_objpfx}localedata/collate-test $id < $cns.in \
    > ${common_objpfx}localedata/$cns.out || here=1
   cmp -s $cns.in ${common_objpfx}localedata/$cns.out || here=1
@@ -44,8 +47,9 @@ for l in $lang; do
     status=1
   fi
 
-  LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
-   LC_ALL=$l ${test_program_prefix} \
+  ${test_program_prefix_before_env} \
+   ${run_program_env} \
+   LC_ALL=$l ${test_program_prefix_after_env} \
    ${common_objpfx}localedata/xfrm-test $id < $cns.in \
    > ${common_objpfx}localedata/$cns.xout || here=1
   cmp -s $cns.in ${common_objpfx}localedata/$cns.xout || here=1
diff --git a/localedata/tst-ctype.sh b/localedata/tst-ctype.sh
index 472f8dc8b0..ae105baaab 100755
--- a/localedata/tst-ctype.sh
+++ b/localedata/tst-ctype.sh
@@ -20,7 +20,9 @@
 set -e
 
 common_objpfx=$1; shift
-tst_ctype=$1; shift
+tst_ctype_before_env=$1; shift
+run_program_env=$1; shift
+tst_ctype_after_env=$1; shift
 status=0
 
 # Run the test programs.
@@ -31,8 +33,9 @@ for loc in C de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 ja_JP.EUC-JP; do
   else
     input=/dev/null
   fi
-  LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-  LC_ALL=$loc ${tst_ctype} < $input \
+  ${tst_ctype_before_env} \
+  ${run_program_env} \
+  LC_ALL=$loc ${tst_ctype_after_env} < $input \
     >> ${common_objpfx}localedata/tst-ctype.out || status=1
 done
 
diff --git a/localedata/tst-fmon.sh b/localedata/tst-fmon.sh
index e68aa96409..7f1b2488a2 100755
--- a/localedata/tst-fmon.sh
+++ b/localedata/tst-fmon.sh
@@ -21,9 +21,11 @@
 set -e
 
 common_objpfx=$1
-run_program_prefix=$2
-test_program_prefix=$3
-datafile=$4
+run_program_prefix_before_env=$2
+run_program_env=$3
+run_program_prefix_after_env=$4
+test_program_prefix=$5
+datafile=$6
 
 here=`pwd`
 
@@ -33,9 +35,10 @@ lang=`sed -e '/^#/d' -e '/^$/d' -e '/^C	/d' -e '/^tstfmon/d' -e 's/^\([^	]*\).*/
 for cns in `cd ./tst-fmon-locales && ls tstfmon_*`; do
     cn=tst-fmon-locales/$cns
     fn=charmaps/ISO-8859-1
-    I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
-    LOCPATH=${common_objpfx}localedata LC_ALL=C LANGUAGE=C \
-    ${run_program_prefix} ${common_objpfx}locale/localedef \
+    ${run_program_prefix_before_env} \
+    ${run_program_env} \
+    I18NPATH=. LANGUAGE=C \
+    ${run_program_prefix_after_env} ${common_objpfx}locale/localedef \
     --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns
 done
 
@@ -46,8 +49,6 @@ while IFS="	" read locale format value expect; do
     case "$locale" in '#'*) continue ;; esac
     if [ -n "$format" ]; then
 	expect=`echo "$expect" | sed 's/^\"\(.*\)\"$/\1/'`
-	LOCPATH=${common_objpfx}localedata \
-	GCONV_PATH=${common_objpfx}/iconvdata \
 	${test_program_prefix} ${common_objpfx}localedata/tst-fmon \
 	"$locale" "$format" "$value" "$expect" < /dev/null ||
 	errcode=$?
diff --git a/localedata/tst-langinfo.sh b/localedata/tst-langinfo.sh
index bd489d024f..df5aed3f55 100755
--- a/localedata/tst-langinfo.sh
+++ b/localedata/tst-langinfo.sh
@@ -20,7 +20,9 @@
 set -e
 
 common_objpfx=$1
-tst_langinfo=$2
+tst_langinfo_before_env=$2
+run_program_env=$3
+tst_langinfo_after_env=$4
 
 # Run the test program.
 cat <<"EOF" |
@@ -339,7 +341,8 @@ ja_JP.EUC-JP         NOEXPR      ^([nNnN]|いいえ|イイエ)
 # ja_JP.EUC-JP         CRNCYSTR    JPY
 ja_JP.EUC-JP         CODESET     EUC-JP
 EOF
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=tt_TT ${tst_langinfo}
+${tst_langinfo_before_env} \
+${run_program_env} \
+LC_ALL=tt_TT ${tst_langinfo_after_env}
 
 exit $?
diff --git a/localedata/tst-locale.sh b/localedata/tst-locale.sh
index b89dc095fa..7c71dcf72c 100755
--- a/localedata/tst-locale.sh
+++ b/localedata/tst-locale.sh
@@ -21,7 +21,9 @@
 set -e
 
 common_objpfx=$1; shift
-localedef=$1; shift
+localedef_before_env=$1; shift
+run_program_env=$1; shift
+localedef_after_env=$1; shift
 
 test_locale ()
 {
@@ -32,9 +34,10 @@ test_locale ()
     if test $rep; then
       rep="--repertoire-map $rep"
     fi
-    I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
-    LOCPATH=${common_objpfx}localedata LC_ALL=C LANGUAGE=C \
-    ${localedef} --quiet -c -f $charmap -i $input \
+    ${localedef_before_env} \
+    ${run_program_env} \
+    I18NPATH=. LANGUAGE=C \
+    ${localedef_after_env} --quiet -c -f $charmap -i $input \
       ${rep} ${common_objpfx}localedata/$out
 
     if [ $? -ne 0 ]; then
diff --git a/localedata/tst-mbswcs.sh b/localedata/tst-mbswcs.sh
index 6a70fd7b62..1cfc482307 100755
--- a/localedata/tst-mbswcs.sh
+++ b/localedata/tst-mbswcs.sh
@@ -25,23 +25,18 @@ test_program_prefix=$1; shift
 status=0
 
 # Run the test programs.
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
 ${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs1 \
   > ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
 ${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs2 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
 ${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs3 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
 ${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs4 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
 ${test_program_prefix} ${common_objpfx}localedata/tst-mbswcs5 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
diff --git a/localedata/tst-numeric.sh b/localedata/tst-numeric.sh
index ff797cd9fa..734466e975 100644
--- a/localedata/tst-numeric.sh
+++ b/localedata/tst-numeric.sh
@@ -30,9 +30,7 @@ errcode=0
 while IFS="	" read locale format value expect; do
     case "$locale" in '#'*) continue ;; esac
     if [ -n "$format" ]; then
-	if LOCPATH=${common_objpfx}localedata \
-	    GCONV_PATH=${common_objpfx}/iconvdata \
-	    ${test_program_prefix} ${common_objpfx}localedata/tst-numeric \
+	if ${test_program_prefix} ${common_objpfx}localedata/tst-numeric \
 	    "$locale" "$format" "$value" "$expect" < /dev/null
 	then
 	    echo "Locale: \"${locale}\" Format: \"${format}\"" \
diff --git a/localedata/tst-rpmatch.sh b/localedata/tst-rpmatch.sh
index bdb3b7c269..a0fd9140f2 100755
--- a/localedata/tst-rpmatch.sh
+++ b/localedata/tst-rpmatch.sh
@@ -26,8 +26,6 @@ tst_rpmatch=$2
 rc=0
 while IFS=\& read locale string result dummy; do
     if [ "$locale" != "#" ]; then
-	LOCPATH=${common_objpfx}localedata \
-	GCONV_PATH=${common_objpfx}/iconvdata \
 	${tst_rpmatch} $locale $string $result < /dev/null \
 	|| { echo "$locale $string $result  FAILED"; exit 1; }
     fi
diff --git a/localedata/tst-trans.sh b/localedata/tst-trans.sh
index e82e4f8b63..99190a5623 100755
--- a/localedata/tst-trans.sh
+++ b/localedata/tst-trans.sh
@@ -20,20 +20,26 @@
 set -e
 
 common_objpfx=$1
-run_program_prefix=$2
-test_program_prefix=$3
+run_program_prefix_before_env=$2
+run_program_env=$3
+run_program_prefix_after_env=$4
+test_program_prefix_before_env=$5
+test_program_prefix_after_env=$6
 
 # Generate the necessary locale data.
-I18NPATH=. GCONV_PATH=${common_objpfx}/iconvdata \
-${run_program_prefix} \
+${run_program_prefix_before_env} \
+${run_program_env} \
+I18NPATH=. \
+${run_program_prefix_after_env} \
 ${common_objpfx}locale/localedef --quiet \
 -i tests/trans.def -f charmaps/ISO-8859-1 \
 ${common_objpfx}localedata/tt_TT ||
 exit 1
 
 # Run the test program.
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=tt_TT ${test_program_prefix} \
+${test_program_prefix_before_env} \
+${run_program_env} \
+LC_ALL=tt_TT ${test_program_prefix_after_env} \
 ${common_objpfx}localedata/tst-trans > ${common_objpfx}localedata/tst-trans.out
 
 exit $?
diff --git a/localedata/tst-wctype.sh b/localedata/tst-wctype.sh
index 31d57bc514..53b88b50b6 100755
--- a/localedata/tst-wctype.sh
+++ b/localedata/tst-wctype.sh
@@ -20,11 +20,14 @@
 set -e
 
 common_objpfx=$1
-tst_wctype=$2
+tst_wctype_before_env=$2
+run_program_env=$3
+tst_wctype_after_env=$4
 
 # Run the test program.
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=ja_JP.EUC-JP ${tst_wctype} < tst-wctype.input \
+${tst_wctype_before_env} \
+${run_program_env} \
+LC_ALL=ja_JP.EUC-JP ${tst_wctype_after_env} < tst-wctype.input \
     > ${common_objpfx}localedata/tst-wctype.out
 
 exit $?
diff --git a/malloc/Makefile b/malloc/Makefile
index 7a716f983f..9e9352341b 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -116,7 +116,8 @@ ifeq ($(run-built-tests),yes)
 ifeq (yes,$(build-shared))
 ifneq ($(PERL),no)
 $(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
-	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+		 '$(run-program-env)' '$(test-program-prefix-after-env)' ; \
 	$(evaluate-test)
 endif
 endif
diff --git a/malloc/tst-mtrace.sh b/malloc/tst-mtrace.sh
index abd425ddf3..446ebec496 100755
--- a/malloc/tst-mtrace.sh
+++ b/malloc/tst-mtrace.sh
@@ -20,14 +20,17 @@
 set -e
 
 common_objpfx=$1; shift
-test_program_prefix=$1; shift
+test_program_prefix_before_env=$1; shift
+run_program_env=$1; shift
+test_program_prefix_after_env=$1; shift
 
 status=0
 trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
 
+${test_program_prefix_before_env} \
+${run_program_env} \
 MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${test_program_prefix} \
+${test_program_prefix_after_env} \
   ${common_objpfx}malloc/tst-mtrace || status=1
 
 if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
diff --git a/manual/install.texi b/manual/install.texi
index d7da02bcb3..08851e1d5b 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -275,13 +275,15 @@ system and @var{hostname}.
 In general, when testing @theglibc{}, @samp{test-wrapper} may be set
 to the name and arguments of any program to run newly built binaries.
 This program must preserve the arguments to the binary being run, its
-working directory, all environment variables set as part of testing
-and the standard input, output and error file descriptors.  If
+working directory and the standard input, output and error file
+descriptors.  If
 @samp{@var{test-wrapper} env} will not work to run a program with
 environment variables set, then @samp{test-wrapper-env} must be set to
 a program that runs a newly built program with environment variable
 assignments in effect, those assignments being specified as
-@samp{@var{var}=@var{value}} before the name of the program to be run.
+@samp{@var{var}=@var{value}} before the name of the program to be
+run.  If multiple assignments to the same variable are specified,
+the last assignment specified must take precedence.
 
 
 @node Running make install
diff --git a/math/Makefile b/math/Makefile
index f337a0ef54..b5cbfda469 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -159,7 +159,7 @@ ifneq (no,$(PERL))
 .PHONY: regen-ulps
 
 run-regen-ulps = $(test-wrapper-env) \
-	    GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+	    $(run-program-env) \
 	    $($*-ENV) $(rtld-prefix) $${run}
 
 regen-ulps: $(addprefix $(objpfx),$(libm-tests))
diff --git a/nptl/Makefile b/nptl/Makefile
index 0bb6ab19c1..cd3be126d6 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -493,7 +493,7 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
 		       $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
 		       $(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
 	$(BASH) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
-	  '$(test-wrapper-env)'; \
+	  '$(test-wrapper-env)' '$(run-program-env)'; \
 	$(evaluate-test)
 endif
 
diff --git a/nptl/tst-tls6.sh b/nptl/tst-tls6.sh
index 5a897fef60..2d31826c7f 100755
--- a/nptl/tst-tls6.sh
+++ b/nptl/tst-tls6.sh
@@ -22,17 +22,13 @@ set -e
 common_objpfx=$1; shift
 test_via_rtld_prefix=$1; shift
 test_wrapper_env=$1; shift
+run_program_env=$1; shift
 logfile=$common_objpfx/nptl/tst-tls6.out
 
 # We have to find libc and nptl
 library_path=${common_objpfx}:${common_objpfx}nptl
 tst_tls5="${test_via_rtld_prefix} ${common_objpfx}/nptl/tst-tls5"
 
-LC_ALL=C
-export LC_ALL
-LANG=C
-export LANG
-
 > $logfile
 fail=0
 
@@ -40,6 +36,7 @@ for aligned in a e f; do
   echo "preload tst-tls5mod{$aligned,b,c,d}.so" >> $logfile
   echo "===============" >> $logfile
   ${test_wrapper_env} \
+  ${run_program_env} LANG=C \
   LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{$aligned,b,c,d}.so \
 	      | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
   echo >> $logfile
@@ -47,6 +44,7 @@ for aligned in a e f; do
   echo "preload tst-tls5mod{b,$aligned,c,d}.so" >> $logfile
   echo "===============" >> $logfile
   ${test_wrapper_env} \
+  ${run_program_env} LANG=C \
   LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{b,$aligned,c,d}.so \
 	      | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
   echo >> $logfile
@@ -54,6 +52,7 @@ for aligned in a e f; do
   echo "preload tst-tls5mod{b,c,d,$aligned}.so" >> $logfile
   echo "===============" >> $logfile
   ${test_wrapper_env} \
+  ${run_program_env} LANG=C \
   LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{b,c,d,$aligned}.so \
 	      | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
   echo >> $logfile
@@ -62,6 +61,7 @@ done
 echo "preload tst-tls5mod{d,a,b,c,e}" >> $logfile
 echo "===============" >> $logfile
 ${test_wrapper_env} \
+${run_program_env} LANG=C \
 LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,c,e}.so \
 	    | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
 echo >> $logfile
@@ -69,6 +69,7 @@ echo >> $logfile
 echo "preload tst-tls5mod{d,a,b,e,f}" >> $logfile
 echo "===============" >> $logfile
 ${test_wrapper_env} \
+${run_program_env} LANG=C \
 LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,e,f}.so \
 	    | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
 echo >> $logfile
diff --git a/posix/Makefile b/posix/Makefile
index 3d7597114f..14e6ceeaf6 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -143,7 +143,8 @@ $(objpfx)globtest.out: globtest.sh $(objpfx)globtest
 		'$(test-program-prefix)' '$(test-wrapper-env)'; \
 	$(evaluate-test)
 $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
-	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+		 '$(run-program-env)' '$(test-program-prefix-after-env)'; \
 	$(evaluate-test)
 endif
 endif
diff --git a/posix/tst-getconf.sh b/posix/tst-getconf.sh
index 1cbebc5b68..0f770c40d0 100644
--- a/posix/tst-getconf.sh
+++ b/posix/tst-getconf.sh
@@ -24,12 +24,6 @@ run_getconf=$1; shift
 
 logfile=$common_objpfx/posix/tst-getconf.out
 
-# Since we use `sort' we must make sure to use the same locale everywhere.
-LC_ALL=C
-export LC_ALL
-LANG=C
-export LANG
-
 rm -f $logfile
 result=0
 while read name; do
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index 392feb0966..2ed239b4cf 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -24,7 +24,9 @@ set -e
 # The others are just there to be parameters.
 
 common_objpfx=$1; shift
-test_program_prefix=$1; shift
+test_program_prefix_before_env=$1; shift
+run_program_env=$1; shift
+test_program_prefix_after_env=$1; shift
 logfile=${common_objpfx}posix/wordexp-tst.out
 testout=${common_objpfx}posix/wordexp-test-result
 
@@ -38,7 +40,8 @@ IFS=" 	\
 export IFS
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
 cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
 wordexp returned 0
@@ -50,7 +53,8 @@ if test $failed -ne 0; then
 fi
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
 cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
 wordexp returned 0
@@ -63,7 +67,8 @@ if test $failed -ne 0; then
 fi
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
 cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
 wordexp returned 0
@@ -76,7 +81,8 @@ if test $failed -ne 0; then
 fi
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
 cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
 wordexp returned 0
@@ -88,7 +94,8 @@ if test $failed -ne 0; then
 fi
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
 cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
 wordexp returned 0
@@ -102,7 +109,8 @@ fi
 # Why?  Because bash does it that way..
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
 cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
 wordexp returned 0
@@ -114,7 +122,8 @@ if test $failed -ne 0; then
 fi
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
 cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1
 wordexp returned 0
@@ -129,7 +138,8 @@ if test $failed -ne 0; then
 fi
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
 cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1
 wordexp returned 0
@@ -141,7 +151,8 @@ if test $failed -ne 0; then
 fi
 
 failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
 cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
 wordexp returned 0
@@ -154,7 +165,8 @@ if test $failed -ne 0; then
   status=1
 fi
 
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
 ${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
 cat <<"EOF" | cmp - ${testout}10 || failed=1
 wordexp returned 0
diff --git a/scripts/cross-test-ssh.sh b/scripts/cross-test-ssh.sh
index 405ae999f5..f2a80a0341 100755
--- a/scripts/cross-test-ssh.sh
+++ b/scripts/cross-test-ssh.sh
@@ -21,17 +21,17 @@
 # Run with --help flag to get more detailed help.
 
 progname="$(basename $0)"
-env_blacklist='HOME LOGNAME MAIL PATH SHELL SHLVL SSH_CLIENT SSH_CONNECTION
-USER TERM TERMCAP PWD'
 
 usage="usage: ${progname} [--ssh SSH] HOST COMMAND ..."
 help="Run a glibc test COMMAND on the remote machine HOST, via ssh,
-passing environment variables, preserving the current working directory,
-and respecting quoting.
+preserving the current working directory, and respecting quoting.
 
 If the '--ssh SSH' flag is present, use SSH as the SSH command,
 instead of ordinary 'ssh'.
 
+If the '--timeoutfactor FACTOR' flag is present, set TIMEOUTFACTOR on
+the remote machine to the specified FACTOR.
+
 To use this to run glibc tests, invoke the tests as follows:
 
   $ make test-wrapper='ABSPATH/cross-test-ssh.sh HOST' tests
@@ -58,13 +58,10 @@ ${progname} itself is run in on the build machine.
 The command and arguments are passed to the remote host in a way that
 avoids any further shell substitution or expansion, on the assumption
 that the shell on the build machine has already done them
-appropriately.
-
-${progname} propagates the values all environment variables through to
-the remote target, except the following:
-${env_blacklist}"
+appropriately."
 
 ssh='ssh'
+timeoutfactor=
 while [ $# -gt 0 ]; do
   case "$1" in
 
@@ -76,6 +73,14 @@ while [ $# -gt 0 ]; do
       ssh="$1"
       ;;
 
+    "--timeoutfactor")
+      shift
+      if [ $# -lt 1 ]; then
+        break
+      fi
+      timeoutfactor="$1"
+      ;;
+
     "--help")
       echo "$usage"
       echo "$help"
@@ -108,26 +113,20 @@ bourne_quote ()
   done
 }
 
-# Unset all variables from the blacklist.  Then echo all exported
-# variables.
-blacklist_exports ()
-{
-  (unset ${env_blacklist}; export -p) | sed 's/^declare -x/export/'
-}
-
-# Produce commands to carry over the current environment, less blacklisted
-# variables.
-exports="$(blacklist_exports)"
-
 # Transform the current argument list into a properly quoted Bourne shell
 # command string.
 command="$(bourne_quote "$@")"
 
-# Add commands to set environment variables and the current directory.
-command="${exports}
-cd $(bourne_quote "$PWD")
+# Add command to set the current directory.
+command="cd $(bourne_quote "$PWD")
 ${command}"
 
+# Add command to set the timeout factor, if required.
+if [ "$timeoutfactor" ]; then
+  command="export TIMEOUTFACTOR=$(bourne_quote "$timeoutfactor")
+${command}"
+fi
+
 # HOST's sshd simply concatenates its arguments with spaces and
 # passes them to some shell.  We want to force the use of /bin/sh,
 # so we need to re-quote the whole command to ensure it appears as
diff --git a/stdio-common/tst-printf.sh b/stdio-common/tst-printf.sh
index 521e66068e..923f6e5649 100644
--- a/stdio-common/tst-printf.sh
+++ b/stdio-common/tst-printf.sh
@@ -24,7 +24,6 @@ test_program_prefix=$1; shift
 
 status=0
 
-LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
 ${test_program_prefix} \
   ${common_objpfx}stdio-common/tst-printf \
   > ${common_objpfx}stdio-common/tst-printf.out || status=1
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 0fdf7cc7d5..9b2271b0b2 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -135,7 +135,9 @@ $(objpfx)isomac: isomac.c
 	$(native-compile)
 
 $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
-	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)stdlib/; \
+	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+		 '$(run-program-env)' '$(test-program-prefix-after-env)' \
+		 $(common-objpfx)stdlib/; \
 	$(evaluate-test)
 
 $(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
diff --git a/stdlib/tst-fmtmsg.sh b/stdlib/tst-fmtmsg.sh
index 4f075dca3c..e3afae00f2 100755
--- a/stdlib/tst-fmtmsg.sh
+++ b/stdlib/tst-fmtmsg.sh
@@ -20,47 +20,47 @@
 set -e
 
 common_objpfx=$1
-test_program_prefix=$2
-objpfx=$3
+test_program_prefix_before_env=$2
+run_program_env=$3
+test_program_prefix_after_env=$4
+objpfx=$5
 
-test="${test_program_prefix} ${objpfx}tst-fmtmsg"
+test_pre="${test_program_prefix_before_env} ${run_program_env}"
+test="${test_program_prefix_after_env} ${objpfx}tst-fmtmsg"
 out=${objpfx}tst-fmtmsg.out
 
-LC_ALL=C
-export LC_ALL
-
-(MSGVERB= $test || exit 1;
- MSGVERB=label $test || exit 1;
- MSGVERB=severity $test || exit 1;
- MSGVERB=severity:label $test || exit 1;
- MSGVERB=text $test || exit 1;
- MSGVERB=text:label $test || exit 1;
- MSGVERB=text:severity $test || exit 1;
- MSGVERB=text:severity:label $test || exit 1;
- MSGVERB=action $test || exit 1;
- MSGVERB=action:label $test || exit 1;
- MSGVERB=action:severity $test || exit 1;
- MSGVERB=action:severity:label $test || exit 1;
- MSGVERB=action:text $test || exit 1;
- MSGVERB=action:text:label $test || exit 1;
- MSGVERB=action:text:severity $test || exit 1;
- MSGVERB=action:text:severity:label $test || exit 1;
- MSGVERB=tag $test || exit 1;
- MSGVERB=tag:label $test || exit 1;
- MSGVERB=tag:severity $test || exit 1;
- MSGVERB=tag:severity:label $test || exit 1;
- MSGVERB=tag:text $test || exit 1;
- MSGVERB=tag:text:label $test || exit 1;
- MSGVERB=tag:text:severity $test || exit 1;
- MSGVERB=tag:text:severity:label $test || exit 1;
- MSGVERB=tag:action $test || exit 1;
- MSGVERB=tag:action:label $test || exit 1;
- MSGVERB=tag:action:severity $test || exit 1;
- MSGVERB=tag:action:severity:label $test || exit 1;
- MSGVERB=tag:action:text $test || exit 1;
- MSGVERB=tag:action:text:label $test || exit 1;
- MSGVERB=tag:action:text:severity $test || exit 1;
- MSGVERB=tag:action:text:severity:label $test || exit 1;) 2> $out
+($test_pre MSGVERB= $test || exit 1;
+ $test_pre MSGVERB=label $test || exit 1;
+ $test_pre MSGVERB=severity $test || exit 1;
+ $test_pre MSGVERB=severity:label $test || exit 1;
+ $test_pre MSGVERB=text $test || exit 1;
+ $test_pre MSGVERB=text:label $test || exit 1;
+ $test_pre MSGVERB=text:severity $test || exit 1;
+ $test_pre MSGVERB=text:severity:label $test || exit 1;
+ $test_pre MSGVERB=action $test || exit 1;
+ $test_pre MSGVERB=action:label $test || exit 1;
+ $test_pre MSGVERB=action:severity $test || exit 1;
+ $test_pre MSGVERB=action:severity:label $test || exit 1;
+ $test_pre MSGVERB=action:text $test || exit 1;
+ $test_pre MSGVERB=action:text:label $test || exit 1;
+ $test_pre MSGVERB=action:text:severity $test || exit 1;
+ $test_pre MSGVERB=action:text:severity:label $test || exit 1;
+ $test_pre MSGVERB=tag $test || exit 1;
+ $test_pre MSGVERB=tag:label $test || exit 1;
+ $test_pre MSGVERB=tag:severity $test || exit 1;
+ $test_pre MSGVERB=tag:severity:label $test || exit 1;
+ $test_pre MSGVERB=tag:text $test || exit 1;
+ $test_pre MSGVERB=tag:text:label $test || exit 1;
+ $test_pre MSGVERB=tag:text:severity $test || exit 1;
+ $test_pre MSGVERB=tag:text:severity:label $test || exit 1;
+ $test_pre MSGVERB=tag:action $test || exit 1;
+ $test_pre MSGVERB=tag:action:label $test || exit 1;
+ $test_pre MSGVERB=tag:action:severity $test || exit 1;
+ $test_pre MSGVERB=tag:action:severity:label $test || exit 1;
+ $test_pre MSGVERB=tag:action:text $test || exit 1;
+ $test_pre MSGVERB=tag:action:text:label $test || exit 1;
+ $test_pre MSGVERB=tag:action:text:severity $test || exit 1;
+ $test_pre MSGVERB=tag:action:text:severity:label $test || exit 1;) 2> $out
 
 cmp $out <<EOF
 GLIBC:tst-fmtmsg: HALT: halt
diff --git a/timezone/Makefile b/timezone/Makefile
index 0aef202536..d10c3a511e 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -80,8 +80,8 @@ CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID -DHAVE_GETTEXT
 # Don't add leapseconds here since test-tz made checks that work only without
 # leapseconds.
 define build-testdata
-GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \
-  $(built-program-cmd) -d $(testdata) -y ./yearistype $<; \
+$(built-program-cmd-before-env) $(run-program-env) LANGUAGE=C \
+  $(built-program-cmd-after-env) -d $(testdata) -y ./yearistype $<; \
 $(evaluate-test)
 endef