(This is a revised version of
<https://sourceware.org/ml/libc-alpha/2014-05/msg00596.html>. This
version puts the common environment variables used by tests in a
variable run-program-env. Various makefile variables are then defined
in terms of that variable and the corresponding -before-env and
-after-env variables, as suggested in
<https://sourceware.org/ml/libc-alpha/2014-05/msg00715.html>; by
including the common environment in variables such as
test-program-prefix, various scripts no longer need to be passed
separate variables but can continue to be passed just one variable as
they are at present. Environment variable settings duplicating the
defaults are cleaned up, and settings on the build system are removed
in the absence of an identified reason they need to remain. A
--timeoutfactor option is added to cross-test-ssh.sh.)
One wart in the original support for test wrappers for cross testing,
as noted in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00722.html>, is the
requirement for test wrappers to pass a poorly-defined set of
environment variables from the build system to the system running the
glibc under test. Although some variables are passed explicitly via
$(test-wrapper-env), including LD_* variables that simply can't be
passed implicitly because of the side effects they'd have on the build
system's dynamic linker, others are passed implicitly, including
variables such as GCONV_PATH and LOCPATH that could potentially affect
the build system's libc (so effectively relying on any such effects
not breaking the wrappers). In addition, the code in
cross-test-ssh.sh for preserving environment variables is fragile (it
depends on how bash formats a list of exported variables, and could
well break for multi-line variable definitions where the contents
contain things looking like other variable definitions).
This patch moves to explicitly passing environment variables via
$(test-wrapper-env). Makefile variables that previously used
$(test-wrapper) are split up into -before-env and -after-env parts
that can be passed separately to the various .sh files used in
testing, so those files can then insert environment settings between
the two parts.
The common default environment settings in make-test-out are made into
a separate makefile variable that can also be passed to scripts,
rather than many scripts duplicating those settings (for testing an
installed glibc, it is desirable to have the GCONV_PATH setting on
just one place, so just that one place needs to support it pointing to
an installed sysroot instead of the build tree). The default settings
are included in the variables such as $(test-program-prefix), so that
if tests do not need any non-default settings they can continue to use
single variables rather than the split-up variables.
Although this patch cleans up LC_ALL=C settings (that being part of
the common defaults), various LANG=C and LANGUAGE=C settings remain.
Those are generally unnecessary and I propose a subsequent cleanup to
remove them. LC_ALL takes precedence over LANG, and while LANGUAGE
takes precedence over LC_ALL, it only does so for settings other than
LC_ALL=C. So LC_ALL=C on its own is sufficient to ensure the C
locale, and anything that gets LC_ALL=C does not need the other
settings.
While preparing this patch I noticed some tests with .sh files that
appeared to do nothing beyond what the generic makefile support for
tests can do (localedata/tst-wctype.sh - the makefiles support -ENV
variables and .input files - and localedata/tst-mbswcs.sh - just runs
five tests that could be run individually from the makefile). So I
propose another subsequent cleanup to move those to using the generic
support instead of special .sh files.
Tested x86_64 (native) and powerpc32 (cross).
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).
localedata/ChangeLog:
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.
@@ -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
========================
@@ -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
@@ -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,$^); \
@@ -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
@@ -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
@@ -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.
@@ -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
@@ -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
@@ -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 \
@@ -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
@@ -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
@@ -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
@@ -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 $?
@@ -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
@@ -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 $?
@@ -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 $?
@@ -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
@@ -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))
@@ -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
@@ -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
@@ -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
@@ -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=$?
@@ -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 ^([nN
# 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 $?
@@ -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
@@ -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
@@ -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}\"" \
@@ -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
@@ -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 $?
@@ -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 $?
@@ -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
@@ -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
@@ -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
@@ -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))
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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