Skip to content

Commit

Permalink
Don't require test wrappers to preserve environment variables, use mo…
Browse files Browse the repository at this point in the history
…re consistent environment.

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).

	* 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:
	* 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.
  • Loading branch information
Joseph Myers committed Jun 6, 2014
1 parent ed36bfa commit 8540f6d
Show file tree
Hide file tree
Showing 45 changed files with 419 additions and 248 deletions.
87 changes: 87 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 8 additions & 7 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -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
========================
Expand Down
45 changes: 36 additions & 9 deletions Makeconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Rules
Original file line number Diff line number Diff line change
Expand Up @@ -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,$^); \
Expand Down
2 changes: 1 addition & 1 deletion benchtests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions catgets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
11 changes: 7 additions & 4 deletions catgets/test-gencat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion elf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions elf/tst-pathopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
3 changes: 2 additions & 1 deletion iconvdata/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 3 additions & 7 deletions iconvdata/run-iconv-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,22 @@
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
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
Expand Down
3 changes: 1 addition & 2 deletions iconvdata/tst-table.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions intl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,17 @@ $(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
$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
$(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
Expand Down
Loading

0 comments on commit 8540f6d

Please sign in to comment.