This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Support cross-testing
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Thu, 18 Oct 2012 23:05:04 +0000
- Subject: Support cross-testing
This patch, mostly originally by Jim Blandy, adds cross-testing
support to glibc.
The idea is that you do "make check
cross-test-wrapper=some-wrapper-command". The wrapper command has the
responsibility of, when run on the build system, executing a command
(typically a test program, but it may also be a program glibc builds
for installation such as localedef, or in some cases a shell script),
on the host for which glibc is built. It must be run with whatever
working directory the wrapper was run with (meaning a shared
filesystem between the build and host systems, with the same location
on both systems), and with any environment variables that may have
been set by glibc's makefiles for running the test. A suitable
wrapper for running tests via ssh is provided in
scripts/cross-test-ssh.sh.
Environment variables set for the dynamic linker can cause problems
for almost any wrapper running on the build system, so in those cases
a script run-with-env.sh is used on the host to set the required
environment variables as late as possible, with the variables on the
build system being set in the form GLIBC_TEST_LD_* rather than LD_*.
Some testcases involve a test program itself execing a test program
passed to it via $(built-program-cmd). Now $(built-program-cmd)
includes the cross-test wrapper for running on the build system, it is
distinguished from $(local-built-program-cmd) which is for running
directly on the host.
When ssh is used to run programs from shell scripts, an issue arises
of ssh reading its input before it is needed by the program run on the
host over ssh. To avoid this consuming text needed elsewhere in the
shell scripts, some scripts are made to redirect input appropriately.
I think such changes are a good idea anyway to avoid tests depending
on the details of exactly what a particular test binary does with its
stdin.
Tested x86_64 (native testing), and with cross to powerpc-linux-gnu
(testing over ssh).
Comments? I fully expect that parts of this patch may need revising
(in which case I'll try to extract pieces that might be able to go in
on their own, such as the use of $(NM) instead of hardcoded nm, or the
input redirection in shell scripts, to reduce the size of the patch
being maintained).
2012-10-18 Jim Blandy <jimb@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* Makeconfig (run-via-rtld-prefix): New variable.
(run-program-prefix): Define in terms of $(run-via-rtld-prefix).
Use $(cross-test-wrapper) and $($*-WRAPPER).
(built-program-cmd): Likewise.
(local-built-program-cmd): New variable.
* Rules [$(cross-compiling) = yes]: Remove conditional code.
[$(cross-compiling) != yes]: Make code unconditional.
* catgets/Makefile [$(cross-compiling) != yes]: Make code
unconditional.
* config.make.in (NM): New variable.
* dlfcn/Makefile (tststatic-ENV): Use GLIBC_TEST_LD_LIBRARY_PATH.
(tststatic2-ENV): Likewise.
(tststatic-WRAPPER): New variable.
(tststatic2-WRAPPER): Likewise.
* elf/Makefile [$(cross-compiling) = no]: Make code unconditional.
(tst-tls9-static-ENV): Use GLIBC_TEST_LD_LIBRARY_PATH.
(tst-tls9-static-WRAPPER): New variable.
(preloadtest-ENV): Use GLIBC_TEST_LD_PRELOAD.
(preloadtest-WRAPPER): New variable.
($(objpfx)order.out): Use $(cross-test-wrapper).
(vismain-ENV): Use GLIBC_TEST_LD_PRELOAD.
(vismain-WRAPPER): New variable.
($(objpfx)tst-pathopt.out): Pass $(cross-test-wrapper) and
$(..)scripts/run-with-env.sh to tst-pathopt.sh.
($(objpfx)tst-rtld-load-self.out): Pass $(cross-test-wrapper) and
$(..)scripts/run-with-env.sh to tst-rtld-load-self.sh.
(tst-audit1-ENV): Use GLIBC_TEST_LD_AUDIT.
(tst-audit2-ENV): Likewise.
(tst-audit3-ENV): Likewise.
(tst-audit4-ENV): Likewise.
(tst-audit5-ENV): Likewise.
(tst-audit6-ENV): Likewise.
(tst-audit7-ENV): Likewise.
(tst-audit1-WRAPPER): New variable.
(tst-audit2-WRAPPER): New variable.
(tst-audit3-WRAPPER): New variable.
(tst-audit4-WRAPPER): New variable.
(tst-audit5-WRAPPER): New variable.
(tst-audit6-WRAPPER): New variable.
(tst-audit7-WRAPPER): New variable.
($(objpfx)order2.out): Use $(cross-test-wrapper).
(tst-stackguard1-ARGS): Use $(local-built-program-cmd).
($(objpfx)tst-initorder.out): Use $(cross-test-wrapper).
($(objpfx)tst-initorder2.out): Likewise.
($(objpfx)tst-unused-dep.out): Use
GLIBC_TEST_LD_TRACE_LOADED_OBJECTS, GLIBC_TEST_LD_DEBUG,
GLIBC_TEST_LD_PRELOAD, $(cross-test-wrapper) and
$(..)scripts/run-with-env.sh.
* elf/tst-pathopt.sh: Expect cross_test_wrapper and run_with_env
arguments.
* elf/tst-rtld-load-self.sh: Likewise.
* grp/Makefile [$(cross-compiling) = no]: Make code unconditional.
($(objpfx)tst_fgetgrent.out): Pass $(cross-test-wrapper) to
tst_fgetgrent.sh.
* grp/tst_fgetgrent.sh: Expect cross_test_wrapper argument.
* iconv/Makefile [$(cross-compiling) != yes]: Make code
unconditional.
* iconvdata/Makefile [$(cross-compiling) = no]: Make code
unconditional.
($(objpfx)iconv-test.out): Pass $(cross-test-wrapper) to
run-iconv-test.sh.
($(objpfx)tst-tables.out): Pass $(cross-test-wrapper) to
tst-tables.sh.
* iconvdata/run-iconv-test.sh: Expect cross_test_wrapper
argument. Avoid reading directly from stdin in loops.
* iconvdata/tst-table.sh: Expect cross_test_wrapper argument.
* iconvdata/tst-tables.sh: Expect cross_test_wrapper argument.
Avoid reading from stdin in loops.
* intl/Makefile [$(cross-compiling) = no]: Make code
unconditional.
($(objpfx)tst-gettext.out): Pass $(cross-test-wrapper) to
tst-gettext.sh.
($(objpfx)tst-translit.out): Pass $(cross-test-wrapper) to
tst-translit.sh.
($(objpfx)tst-gettext2.out): Pass $(cross-test-wrapper) to
tst-gettext2.sh.
* intl/tst-gettext.sh: Expect cross_test_wrapper argument.
* intl/tst-gettext2.sh: Likewise.
* intl/tst-translit.sh: Likewise.
* io/Makefile [$(cross-compiling) = no]: Make code unconditional.
(ftwtest-tmpdir): Define dependent on [$(cross-compiling) = yes].
( $(objpfx)ftwtest.out): Use $(ftwtest-tmpdir). Pass
$(cross-test-wrapper) and run-with-env.sh to ftwtest-sh.
* io/ftwtest-sh: Expect cross_test_wrapper and run_with_env
arguments. Use GLIBC_TEST_LD_LIBRARY_PATH.
* libio/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* localedata/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* localedata/tst-fmon.sh: Redirect test program input from
/dev/null.
* localedata/tst-numeric.sh: Likewise.
* localedata/tst-rpmatch.sh: Likewise.
* localedata/tst-wctype.sh: Take second argument as being command
to run tst-wctype program.
* malloc/Makefile [$(cross-compiling) = no]: Make code
unconditional.
($(objpfx)tst-mtrace.out): Pass $(cross-test-wrapper) to
tst-mtrace.sh.
* malloc/tst-mtrace.sh: Expect cross_test_wrapper argument.
* misc/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* posix/Makefile [$(cross-compiling) = no]: Make code
unconditional.
($(objpfx)globtest.out): Pass $(cross-test-wrapper) to
globtest.sh.
($(objpfx)wordexp-tst.out): Pass $(cross-test-wrapper) to
wordexp-tst.sh.
(tst-exec-ARGS): Use $(local-built-program-cmd).
(tst-spawn-ARGS): Likewise.
($(objpfx)tst-getconf.out): Pass $(cross-test-wrapper) to
tst-getconf.sh.
* posix/globtest.sh: Expect cross_test_wrapper argument.
* posix/tst-getconf.sh: Likewise.
* posix/wordexp-tst.sh: Likewise.
* resolv/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* rt/Makefile (tst-mqueue7-ARGS): Use $(local-built-program-cmd).
* scripts/cross-test-ssh.sh: New file.
* scripts/run-with-env.sh: Likewise.
* stdio-common/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* stdlib/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* string/Makefile [$(cross-compiling) = no]: Make code
unconditional.
nptl:
2012-10-18 Jim Blandy <jimb@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* Makefile [$(cross-compiling) = no]: Make code unconditional.
(tst-cancel7-ARGS): Use $(local-built-program-cmd).
(tst-exec4-ARGS): Likewise.
(tst-stackguard1-ARGS): Likewise.
($(objpfx)tst-tls6.out): Pass $(cross-test-wrapper) and
$(..)scripts/run-with-env.sh to tst-tls6.sh.
($(objpfx)tst-cancel-wrappers.out): Pass $(NM) to
tst-cancel-wrappers.sh.
* tst-cancel-wrappers.sh: Use nm program given as first argument,
not hardcoded "nm".
* tst-tls6.sh: Expect cross_test_wrapper and run_with_env
arguments. Use GLIBC_TEST_LD_PRELOAD.
(preloads): New function. Refactored from individual test
commands.
diff --git a/Makeconfig b/Makeconfig
index f451ec2..17720de 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -606,17 +606,25 @@ sysdep-library-path = \
$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
$(filter -Wl$(comma)-rpath-link=%,\
$(sysdep-LDFLAGS)))))
-run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
- $(tests-static) $(xtests-static)),, \
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
+# Never use $(run-via-rtld-prefix) for the statically-linked %-bp test
+# programs, or for tests listed in tests-static or xtests-static.
+run-via-rtld-prefix = \
+ $(if $(strip $(filter $(notdir $(built-program-file)), \
+ $(tests-static) $(xtests-static)) \
+ $(filter %-bp,$(built-program-file))),, \
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
else
-run-program-prefix =
+run-via-rtld-prefix =
endif
-# Never use $(run-program-prefix) for the statically-linked %-bp test programs
-built-program-cmd = $(patsubst %,$(run-program-prefix),\
- $(filter-out %-bp,$(built-program-file))) \
- $(built-program-file)
+run-program-prefix = $(cross-test-wrapper) $($*-WRAPPER) \
+ $(run-via-rtld-prefix)
+built-program-cmd = $(cross-test-wrapper) $($*-WRAPPER) \
+ $(run-via-rtld-prefix) $(built-program-file)
+
+# Same as built-program-cmd, but without the cross-test-wrapper. Used
+# to run programs from the test machine, as in nptl/tst-cancel7.
+local-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file)
ifndef LD
LD := ld -X
diff --git a/Rules b/Rules
index 5e33610..9dd994a 100644
--- a/Rules
+++ b/Rules
@@ -94,17 +94,12 @@ others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
else
others: $(addprefix $(objpfx),$(extra-objs))
endif
-ifeq ($(cross-compiling),yes)
-tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
-xtests: tests
-else
ifeq ($(build-bounded),yes)
tests-bp.out = $(tests:%=$(objpfx)%-bp.out)
xtests-bp.out = $(xtests:%=$(objpfx)%-bp.out)
endif
tests: $(tests:%=$(objpfx)%.out) $(tests-bp.out)
xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out)
-endif
ifeq ($(build-programs),yes)
binaries-all-notests = $(others) $(sysdep-others)
diff --git a/catgets/Makefile b/catgets/Makefile
index ec8fe1e..d2db447 100644
--- a/catgets/Makefile
+++ b/catgets/Makefile
@@ -50,7 +50,6 @@ generated-dirs = de
tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de
-ifneq ($(cross-compiling),yes)
tests: $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
$(objpfx)test-gencat.out
# This test just checks whether the program produces any error or not.
@@ -80,4 +79,3 @@ $(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
$(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,$^) > $@
-endif
diff --git a/config.make.in b/config.make.in
index b6d1c94..c22acf4 100644
--- a/config.make.in
+++ b/config.make.in
@@ -111,6 +111,7 @@ CPPFLAGS-config = @CPPFLAGS@
CPPUNDEFS = @CPPUNDEFS@
ASFLAGS-config = @ASFLAGS_config@
AR = @AR@
+NM = @NM@
MAKEINFO = @MAKEINFO@
AS = $(CC) -c
MIG = @MIG@
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index 1a2d2e8..e587ca7 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -50,8 +50,12 @@ ifeq (yes,$(build-shared))
tests += tststatic tststatic2
tests-static += tststatic tststatic2
modules-names += modstatic modstatic2
-tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
-tststatic2-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
+tststatic-ENV = \
+ GLIBC_TEST_LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
+tststatic-WRAPPER = $(..)scripts/run-with-env.sh
+tststatic2-ENV = \
+ GLIBC_TEST_LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
+tststatic2-WRAPPER = $(..)scripts/run-with-env.sh
endif
extra-test-objs += $(modules-names:=.os)
diff --git a/elf/Makefile b/elf/Makefile
index e91c3b4..626a52b 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -123,7 +123,8 @@ tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static
ifeq (yes,$(build-shared))
tests-static += tst-tls9-static
tst-tls9-static-ENV = \
- LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
+ GLIBC_TEST_LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
+tst-tls9-static-WRAPPER = $(..)scripts/run-with-env.sh
endif
ifeq (yes,$(have-initfini-array))
tests-static += tst-array1-static tst-array5-static
@@ -160,9 +161,7 @@ tests += tst-audit6 tst-audit7
endif
endif
endif
-ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
-endif
tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
@@ -436,10 +435,8 @@ test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
generated += $(addsuffix .so,$(strip $(modules-names)))
ifeq (yes,$(build-shared))
-ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
endif
-endif
$(objpfx)testobj1.so: $(libdl)
$(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
@@ -604,7 +601,8 @@ $(objpfx)preloadtest: $(objpfx)testobj6.so
LDFLAGS-preloadtest = -rdynamic
$(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
preloadtest-ENV = \
- LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
+ GLIBC_TEST_LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
+preloadtest-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)loadfail: $(libdl)
LDFLAGS-loadfail = -rdynamic
@@ -642,6 +640,7 @@ $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
$(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
$(objpfx)order.out: $(objpfx)order
+ $(cross-test-wrapper) \
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(objpfx)order > $@
@@ -649,7 +648,8 @@ $(objpfx)order.out: $(objpfx)order
$(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
$(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
-vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
+vismain-ENV = GLIBC_TEST_LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
+vismain-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
LDFLAGS-noload = -rdynamic $(no-as-needed)
@@ -708,10 +708,11 @@ $(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)
+ $(SHELL) $< $(common-objpfx) "$(cross-test-wrapper)" \
+ $(..)scripts/run-with-env.sh
$(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
- $(SHELL) $^ > $@
+ $(SHELL) $^ "$(cross-test-wrapper)" $(..)scripts/run-with-env.sh > $@
$(objpfx)initfirst: $(libdl)
$(objpfx)initfirst.out: $(objpfx)firstobj.so
@@ -1001,31 +1002,39 @@ $(objpfx)tst-dlmopen3: $(libdl)
$(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
$(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
-tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit1-ENV = GLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit1-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
-tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit2-ENV = GLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit2-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
$(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
-tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
+tst-audit3-ENV = GLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod3b.so
+tst-audit3-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-audit4: $(objpfx)tst-auditmod4a.so
$(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
-tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
+tst-audit4-ENV = GLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod4b.so
+tst-audit4-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
$(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
-tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
+tst-audit5-ENV = GLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod5b.so
+tst-audit5-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-audit6: $(objpfx)tst-auditmod6a.so
$(objpfx)tst-audit6.out: $(objpfx)tst-auditmod6b.so \
$(objpfx)tst-auditmod6c.so
-tst-audit6-ENV = LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
+tst-audit6-ENV = \
+ GLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
+tst-audit6-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
$(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
-tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
+tst-audit7-ENV = GLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod7b.so
+tst-audit7-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-global1: $(libdl)
$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
@@ -1033,6 +1042,7 @@ $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
$(objpfx)order2: $(libdl)
$(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
$(objpfx)order2mod2.so
+ $(cross-test-wrapper) \
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(objpfx)order2 > $@
@@ -1044,7 +1054,7 @@ order2mod2.so-no-z-defs = yes
LDFLAGS-order2mod1.so = $(no-as-needed)
LDFLAGS-order2mod2.so = $(no-as-needed)
-tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
+tst-stackguard1-ARGS = --command "$(local-built-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
$(objpfx)tst-leaks1: $(libdl)
@@ -1122,6 +1132,7 @@ $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
+ $(cross-test-wrapper) \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
@@ -1143,6 +1154,7 @@ object-suffixes-left := a b c d
include $(o-iterator)
$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
+ $(cross-test-wrapper) \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
@@ -1167,14 +1179,14 @@ $(objpfx)tst-relsort1mod2.so: $(libm)
$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
$(objpfx)tst-relsort1mod2.so
-ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-unused-dep.out
-endif
$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
- LD_TRACE_LOADED_OBJECTS=1 \
- LD_DEBUG=unused \
- LD_PRELOAD= \
+ GLIBC_TEST_LD_TRACE_LOADED_OBJECTS=1 \
+ GLIBC_TEST_LD_DEBUG=unused \
+ GLIBC_TEST_LD_PRELOAD= \
+ $(cross-test-wrapper) \
+ $(..)scripts/run-with-env.sh \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
diff --git a/elf/tst-pathopt.sh b/elf/tst-pathopt.sh
index 048c612..6305bcb 100755
--- a/elf/tst-pathopt.sh
+++ b/elf/tst-pathopt.sh
@@ -20,7 +20,8 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+cross_test_wrapper="$2"
+run_with_env="$3"
test -e ${common_objpfx}elf/will-be-empty &&
rm -fr ${common_objpfx}elf/will-be-empty
@@ -30,8 +31,9 @@ test -d ${common_objpfx}elf/for-renamed ||
cp ${common_objpfx}elf/pathoptobj.so ${common_objpfx}elf/for-renamed/renamed.so
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 \
- ${common_objpfx}elf/ld.so ${common_objpfx}elf/tst-pathopt \
+LC_ALL=C GLIBC_TEST_LD_LIBRARY_PATH=${common_objpfx}elf/will-be-empty:${common_objpfx}elf/for-renamed:${common_objpfx}.:${common_objpfx}dlfcn \
+ ${cross_test_wrapper} ${run_with_env} ${common_objpfx}elf/ld.so \
+ ${common_objpfx}elf/tst-pathopt \
> ${common_objpfx}elf/tst-pathopt.out
exit $?
diff --git a/elf/tst-rtld-load-self.sh b/elf/tst-rtld-load-self.sh
index f4c5dea..107835a 100755
--- a/elf/tst-rtld-load-self.sh
+++ b/elf/tst-rtld-load-self.sh
@@ -21,25 +21,28 @@
set -e
rtld=$1
+cross_test_wrapper="$2"
+run_with_env="$3"
result=0
echo '# normal mode'
-$rtld $rtld 2>&1 && rc=0 || rc=$?
+${cross_test_wrapper} $rtld $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -le 127 || result=1
echo '# list mode'
-$rtld --list $rtld 2>&1 && rc=0 || rc=$?
+${cross_test_wrapper} $rtld --list $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -eq 0 || result=1
echo '# verify mode'
-$rtld --verify $rtld 2>&1 && rc=0 || rc=$?
+${cross_test_wrapper} $rtld --verify $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -eq 2 || result=1
echo '# trace mode'
-LD_TRACE_LOADED_OBJECTS=1 $rtld $rtld 2>&1 && rc=0 || rc=$?
+GLIBC_TEST_LD_TRACE_LOADED_OBJECTS=1 ${cross_test_wrapper} ${run_with_env} \
+ $rtld $rtld 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
test $rc -eq 0 || result=1
diff --git a/grp/Makefile b/grp/Makefile
index 8cb99c1..ab15774 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -50,13 +50,11 @@ CFLAGS-getgrgid.c = -fexceptions
endif
-ifeq (no,$(cross-compiling))
# tst_fgetgrent currently only works with shared libraries
ifeq (yes,$(build-shared))
tests: $(objpfx)tst_fgetgrent.out
$(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name)
+ $(rtld-installed-name) "$(cross-test-wrapper)"
endif
-endif
diff --git a/grp/tst_fgetgrent.sh b/grp/tst_fgetgrent.sh
index 7e69815..5d14ab1 100644
--- a/grp/tst_fgetgrent.sh
+++ b/grp/tst_fgetgrent.sh
@@ -22,21 +22,26 @@ set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+cross_test_wrapper="$1"; shift
testout=${common_objpfx}/grp/tst_fgetgrent.out
library_path=${common_objpfx}
result=0
+${cross_test_wrapper} \
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}grp/tst_fgetgrent 0 > ${testout} || result=1
+${cross_test_wrapper} \
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}grp/tst_fgetgrent 1 >> ${testout} || result=1
+${cross_test_wrapper} \
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}grp/tst_fgetgrent 2 >> ${testout} || result=1
+${cross_test_wrapper} \
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}grp/tst_fgetgrent 3 >> ${testout} || result=1
diff --git a/iconv/Makefile b/iconv/Makefile
index 6d77911..14c6bbc 100644
--- a/iconv/Makefile
+++ b/iconv/Makefile
@@ -69,9 +69,7 @@ $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
$(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
$(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o)
-ifneq ($(cross-compiling),yes)
xtests: test-iconvconfig
-endif
.PHONY: test-iconvconfig
test-iconvconfig: /dev/null $(objpfx)iconvconfig
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 2ddcae5..a754fa4 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -267,14 +267,12 @@ endif # build-shared = yes
include ../Rules
-ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
tests: $(objpfx)iconv-test.out $(objpfx)tst-tables.out
ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-loading
endif
endif
-endif
tst-loading-ENV = MALLOC_TRACE=$(objpfx)tst-loading.mtrace
$(objpfx)mtrace-tst-loading: $(objpfx)tst-loading.out
@@ -299,12 +297,13 @@ $(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) > $@
+ $(SHELL) $< $(common-objdir) '$(cross-test-wrapper)' > $@
$(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
$(objpfx)tst-table-from $(objpfx)tst-table-to
- $(SHELL) $< $(common-objpfx) $(common-objpfx)iconvdata/ > $@
+ $(SHELL) $< $(common-objpfx) $(common-objpfx)iconvdata/ \
+ '$(cross-test-wrapper)' > $@
do-tests-clean common-mostlyclean: tst-tables-clean
diff --git a/iconvdata/run-iconv-test.sh b/iconvdata/run-iconv-test.sh
index 34c400d..71e635e 100755
--- a/iconvdata/run-iconv-test.sh
+++ b/iconvdata/run-iconv-test.sh
@@ -21,6 +21,7 @@
set -e
codir=$1
+cross_test_wrapper="$2"
# We use always the same temporary file.
temp1=$codir/iconvdata/iconv-test.xxx
@@ -39,6 +40,7 @@ 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="$cross_test_wrapper $ICONV"
# Which echo?
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
@@ -49,8 +51,13 @@ fi
# We read the file named TESTS. All non-empty lines not starting with
# `#' are interpreted as commands.
+# Avoid reading from stdin, since the while loop's body inherits that;
+# if cross_test_wrapper is a program like ssh that reads its input
+# even if the program running on the remote side doesn't, it will
+# steal input from the loop.
failed=0
-while read from to subset targets; do
+exec 5< TESTS
+while read from to subset targets <&5; do
# Ignore empty and comment lines.
if test -z "$subset" || test "$from" = '#'; then continue; fi
@@ -141,11 +148,18 @@ while read from to subset targets; do
{ echo "/FAILED"; failed=1; continue; }
echo "/OK"
fi
-done < TESTS
+done
+# Close TESTS.
+exec 5<&-
# We read the file named TESTS2. All non-empty lines not starting with
# `#' are interpreted as commands.
-while read utf8 from filename; do
+# Avoid reading from stdin, since the while loop's body inherits that;
+# if cross_test_wrapper is a program like ssh that reads its input
+# even if the program running on the remote side doesn't, it will
+# steal input from the loop.
+exec 5< TESTS2
+while read utf8 from filename <&5; do
# Ignore empty and comment lines.
if test -z "$filename" || test "$utf8" = '#'; then continue; fi
@@ -184,7 +198,8 @@ while read utf8 from filename; do
{ echo "/FAILED"; failed=1; continue; }
echo "OK"
-done < TESTS2
+done
+exec 5<&-
exit $failed
# Local Variables:
diff --git a/iconvdata/tst-table.sh b/iconvdata/tst-table.sh
index 05f7c6f..45828fb 100755
--- a/iconvdata/tst-table.sh
+++ b/iconvdata/tst-table.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
#
@@ -23,8 +23,9 @@
common_objpfx=$1
objpfx=$2
-charset=$3
-charmap=$4
+cross_test_wrapper="$3"
+charset=$4
+charmap=$5
GCONV_PATH=${common_objpfx}iconvdata
export GCONV_PATH
@@ -59,12 +60,12 @@ else
fi
# iconv in one direction.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${cross_test_wrapper} ${common_objpfx}elf/ld.so --library-path $common_objpfx \
${objpfx}tst-table-from ${charset} \
> ${objpfx}tst-${charset}.table
# iconv in the other direction.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${cross_test_wrapper} ${common_objpfx}elf/ld.so --library-path $common_objpfx \
${objpfx}tst-table-to ${charset} | sort \
> ${objpfx}tst-${charset}.inverse.table
diff --git a/iconvdata/tst-tables.sh b/iconvdata/tst-tables.sh
index b66d484..57c9744 100755
--- a/iconvdata/tst-tables.sh
+++ b/iconvdata/tst-tables.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2000-2004,2007,2011 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
#
@@ -23,6 +23,7 @@
common_objpfx=$1
objpfx=$2
+cross_test_wrapper="$3"
status=0
@@ -261,7 +262,10 @@ while read charset charmap; do
if test "$charset" = GB18030; then echo "This might take a while" 1>&2; fi
case ${charset} in \#*) continue;; esac
echo -n "Testing ${charset}" 1>&2
- if ${SHELL} tst-table.sh ${common_objpfx} ${objpfx} ${charset} ${charmap}; then
+ # Redirect input from /dev/null, so that using ssh (which reads its
+ # input before the remote program needs it) won't consume the rest of the
+ # charset/charmap table, making the while loop terminate early.
+ if ${SHELL} tst-table.sh ${common_objpfx} ${objpfx} "${cross_test_wrapper}" ${charset} ${charmap} < /dev/null; then
echo 1>&2
else
echo "failed: ./tst-table.sh ${common_objpfx} ${objpfx} ${charset} ${charmap}"
diff --git a/intl/Makefile b/intl/Makefile
index 764badc..520cb33 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -48,7 +48,6 @@ $(objpfx)plural.o: plural.c
include ../Rules
-ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
ifneq ($(strip $(MSGFMT)),:)
tests: $(objpfx)tst-translit.out $(objpfx)tst-gettext2.out \
@@ -75,11 +74,13 @@ $(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
$(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
$(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
- $(objpfx)tst-gettext.mtrace
+ $(objpfx)tst-gettext.mtrace '$(cross-test-wrapper)'
$(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
- $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/
+ $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
+ '$(cross-test-wrapper)'
$(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
- $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/
+ $(SHELL) $< $(common-objpfx) $(common-objpfx)intl/ \
+ '$(cross-test-wrapper)'
$(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
@@ -89,7 +90,6 @@ $(objpfx)tst-codeset.out: $(codeset_mo)
$(objpfx)tst-gettext3.out: $(codeset_mo)
$(objpfx)tst-gettext5.out: $(codeset_mo)
endif
-endif
$(objpfx)msgs.h: po2test.awk ../po/de.po
$(make-target-directory)
diff --git a/intl/tst-gettext.sh b/intl/tst-gettext.sh
index a3ac377..fd36191 100755
--- a/intl/tst-gettext.sh
+++ b/intl/tst-gettext.sh
@@ -22,6 +22,7 @@ set -e
common_objpfx=$1
objpfx=$2
malloc_trace=$3
+cross_test_wrapper=$4
LC_ALL=C
export LC_ALL
@@ -53,6 +54,7 @@ export LOCPATH
# Now run the test.
MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+${cross_test_wrapper} \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
diff --git a/intl/tst-gettext2.sh b/intl/tst-gettext2.sh
index 2d9c52f..b6f439d 100644
--- a/intl/tst-gettext2.sh
+++ b/intl/tst-gettext2.sh
@@ -21,6 +21,7 @@ set -e
common_objpfx=$1
objpfx=$2
+cross_test_wrapper=$3
LC_ALL=C
export LC_ALL
@@ -66,6 +67,7 @@ LOCPATH=${objpfx}domaindir
export LOCPATH
# Now run the test.
+${cross_test_wrapper} \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
cmp ${objpfx}tst-gettext2.out - <<EOF
diff --git a/intl/tst-translit.sh b/intl/tst-translit.sh
index 93159c7..ba88928 100755
--- a/intl/tst-translit.sh
+++ b/intl/tst-translit.sh
@@ -21,6 +21,7 @@ set -e
common_objpfx=$1
objpfx=$2
+cross_test_wrapper=$3
LC_ALL=C
export LC_ALL
@@ -36,6 +37,7 @@ export GCONV_PATH
LOCPATH=${common_objpfx}localedata
export LOCPATH
+${cross_test_wrapper} \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
diff --git a/io/Makefile b/io/Makefile
index f6534c0..908bdd2 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -98,10 +98,20 @@ test-stat2-ARGS = Makefile . $(objpfx)test-stat2
tst-statvfs-ARGS = $(objpfx)tst-statvfs tst-statvfs.c /tmp
-ifeq ($(cross-compiling),no)
tests: $(objpfx)ftwtest.out
+ifeq ($(cross-compiling),yes)
+# Cross-testing does not require the build and host machines to share
+# a /tmp directory, so when cross-testing, construct the sample
+# directory tree for these tests in the build tree.
+ftwtest-tmpdir = TMPDIR=$(common-objpfx)
+else
+ftwtest-tmpdir =
+endif
+
$(objpfx)ftwtest.out: $(objpfx)ftwtest
+ $(ftwtest-tmpdir) \
$(SHELL) ftwtest-sh $(shell cd $(common-objpfx). && pwd)/ \
+ '$(cross-test-wrapper)' \
+ $(shell cd $(..)scripts && pwd)/run-with-env.sh \
$(shell cd $(<D) && pwd)/$(<F) > $@
-endif
diff --git a/io/ftwtest-sh b/io/ftwtest-sh
index 1822ea7..b31653f 100644
--- a/io/ftwtest-sh
+++ b/io/ftwtest-sh
@@ -22,6 +22,12 @@ set -e
# The common objpfx, used to find libraries and the dynamic loader.
objpfx=$1
+# The cross-testing wrapper.
+cross_test_wrapper="$2"
+
+# The environment-setting wrapper.
+run_with_env="$3"
+
# We expect one parameter which is the test program. This must understand
# a number options:
# --phys use the FTW_PHYS flag
@@ -30,7 +36,7 @@ objpfx=$1
# --depth use the FTW_DEPTH flag
# --early-exit print file@2 item only and return non-zero from the
# callback when it is seen
-testprogram=$2
+testprogram=$4
# We cannot test this as root.
if test `id | sed "s/uid=\([0-9]*\).*/\1/"` = 0; then
@@ -48,6 +54,7 @@ tmp=`echo ${TMPDIR:-/tmp} | sed 's|\(.\)/*$|\1|'`
tmpdir=$tmp/ftwtest.d
[ -f ${objpfx}elf/ld.so ] && ldso=${objpfx}elf/ld.so
+ldso="${cross_test_wrapper:+$cross_test_wrapper }$run_with_env $ldso"
trap 'chmod -fR a+x $tmpdir; rm -fr $tmpdir $testout' 1 2 3 15
@@ -73,7 +80,7 @@ chmod a-x,a+r $tmpdir/bar
testout=${TMPDIR:-/tmp}/ftwtest.out
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -92,7 +99,7 @@ base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, leve
EOF
rm $testout
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --depth $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --depth $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -111,7 +118,7 @@ base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, leve
EOF
rm $testout
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --phys $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --phys $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -135,7 +142,7 @@ rm $testout
# For the next test everything must be readable.
chmod -fR a+x $tmpdir
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir $tmpdir |
sort > $testout
# perhaps $tmp involves some symlinks...
@@ -159,7 +166,7 @@ rm $testout
curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
cd "$tmp"
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d |
sort > $testout
cd "$curwd"
@@ -181,7 +188,7 @@ rm $testout
curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
cd "$tmp"
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. |
sort > $testout
cd "$curwd"
@@ -203,7 +210,7 @@ rm $testout
curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
cd "$tmp"
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 |
sort > $testout
cd "$curwd"
@@ -212,7 +219,7 @@ base = "ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN, cwd = $tmpreal/ft
EOF
rm $testout
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --early-exit $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --early-exit $tmpdir |
sort > $testout
cat <<EOF | cmp $testout - || exit 1
@@ -226,7 +233,7 @@ echo > $tmpdir/foo/lvl1b/file@1b
echo > $tmpdir/foo/lvl1b/file2@1b
echo > $tmpdir/foo/lvl1b/file3@1b
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-subtree=lvl1 $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-subtree=lvl1 $tmpdir |
sort > $testout
cat <<EOF | diff -u $testout - || exit 1
@@ -243,7 +250,7 @@ base = "$tmp/ftwtest.d/foo/lvl1b/", file = "file@1b", flag = FTW_F, level = 3
EOF
rm $testout
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=lvl1 $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=lvl1 $tmpdir |
sort > $testout
# The filesystem is not required to put lvl1 before lvl1b.
@@ -267,7 +274,7 @@ base = "$tmp/ftwtest.d/foo/lvl1b/", file = "file@1b", flag = FTW_F, level = 3
EOF
rm $testout
-LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=file@1b $tmpdir |
+GLIBC_TEST_LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=file@1b $tmpdir |
sort > $testout
# The filesystem is not required to put file2@1b and file3@1b after file@1b.
diff --git a/libio/Makefile b/libio/Makefile
index 0d28cea..420a1a5 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -175,14 +175,12 @@ shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \
include ../Rules
-ifeq (no,$(cross-compiling))
tests: $(objpfx)test-freopen.out
ifeq (yes,$(build-shared))
# Run tst-fopenloc.check only if shared library is enabled since it
# depends on tst-fopenloc.out.
tests: $(objpfx)tst-fopenloc.check
endif
-endif
$(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
diff --git a/localedata/Makefile b/localedata/Makefile
index 5be2413..491c061 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -59,7 +59,6 @@ generated-dirs := $(ld-test-names) tt_TT de_DE.437 \
# Get $(inst_i18ndir) defined.
include ../Makeconfig
-ifeq (no,$(cross-compiling))
locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
tst_iswctype tst_iswdigit tst_iswgraph \
tst_iswlower tst_iswprint tst_iswpunct \
@@ -83,7 +82,6 @@ ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-leaks
endif
endif
-endif
# Files to install.
install-others := $(addprefix $(inst_i18ndir)/, \
@@ -113,7 +111,6 @@ CFLAGS-tst-mbswcs5.c = -Wno-format
CFLAGS-tst-trans.c = -Wno-format
-ifeq (no,$(cross-compiling))
# We have to generate locales
LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \
@@ -186,7 +183,6 @@ $(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
$(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
-endif
include SUPPORTED
diff --git a/localedata/tst-fmon.sh b/localedata/tst-fmon.sh
index 3e3dba9..7e6d7f1 100755
--- a/localedata/tst-fmon.sh
+++ b/localedata/tst-fmon.sh
@@ -32,10 +32,13 @@ 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
+ # If run_program_prefix includes a cross-testing wrapper based on a
+ # program like ssh, it may steal input from the while loop, so
+ # redirect its stdin from /dev/null.
I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
LOCPATH=${common_objpfx}localedata LC_ALL=C LANGUAGE=C \
${run_program_prefix} ${common_objpfx}locale/localedef \
- --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns
+ --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns < /dev/null
done
# Run the tests.
@@ -45,10 +48,13 @@ while IFS=" " read locale format value expect; do
case "$locale" in '#'*) continue ;; esac
if [ -n "$format" ]; then
expect=`echo "$expect" | sed 's/^\"\(.*\)\"$/\1/'`
+ # If run_program_prefix includes a cross-testing wrapper based on a
+ # program like ssh, it may steal input from the while loop, so
+ # redirect its stdin from /dev/null.
LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
${run_program_prefix} ${common_objpfx}localedata/tst-fmon \
- "$locale" "$format" "$value" "$expect" ||
+ "$locale" "$format" "$value" "$expect" < /dev/null ||
errcode=$?
fi
done < $datafile
diff --git a/localedata/tst-numeric.sh b/localedata/tst-numeric.sh
index 71a3058..a675847 100644
--- a/localedata/tst-numeric.sh
+++ b/localedata/tst-numeric.sh
@@ -30,10 +30,13 @@ errcode=0
while IFS=" " read locale format value expect; do
case "$locale" in '#'*) continue ;; esac
if [ -n "$format" ]; then
+ # If run_program_prefix includes a cross-testing wrapper based
+ # on a program like ssh, it may steal input from the while
+ # loop, so redirect its stdin from /dev/null.
if LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
${run_program_prefix} ${common_objpfx}localedata/tst-numeric \
- "$locale" "$format" "$value" "$expect"
+ "$locale" "$format" "$value" "$expect" < /dev/null
then
echo "Locale: \"${locale}\" Format: \"${format}\"" \
"Value: \"${value}\" Expect: \"${expect}\" passed"
diff --git a/localedata/tst-rpmatch.sh b/localedata/tst-rpmatch.sh
index 0fb0cdf..b71416e 100755
--- a/localedata/tst-rpmatch.sh
+++ b/localedata/tst-rpmatch.sh
@@ -26,9 +26,12 @@ tst_rpmatch=$2
rc=0
while IFS=\& read locale string result dummy; do
if [ "$locale" != "#" ]; then
+ # If tst_rpmatch includes a cross-testing wrapper based on a
+ # program like ssh, it may steal input from the while loop, so
+ # redirect its stdin from /dev/null.
LOCPATH=${common_objpfx}localedata \
GCONV_PATH=${common_objpfx}/iconvdata \
- ${tst_rpmatch} $locale $string $result \
+ ${tst_rpmatch} $locale $string $result < /dev/null \
|| { echo "$locale $string $result FAILED"; exit 1; }
fi
done <<EOF
diff --git a/localedata/tst-wctype.sh b/localedata/tst-wctype.sh
index 0dd8a82..8cb34b8 100755
--- a/localedata/tst-wctype.sh
+++ b/localedata/tst-wctype.sh
@@ -20,12 +20,11 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+tst_wctype=$2
# Run the test program.
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=ja_JP.EUC-JP ${run_program_prefix} \
- ${common_objpfx}localedata/tst-wctype < tst-wctype.input \
+LC_ALL=ja_JP.EUC-JP ${tst_wctype} < tst-wctype.input \
> ${common_objpfx}localedata/tst-wctype.out
exit $?
diff --git a/malloc/Makefile b/malloc/Makefile
index eb909fd..ab03473 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -104,13 +104,11 @@ $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
lib: $(objpfx)libmcheck.a
-ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
ifneq ($(PERL),no)
tests: $(objpfx)tst-mtrace.out
$(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
- $(SHELL) $< $(common-objpfx)
-endif
+ $(SHELL) $< $(common-objpfx) '$(cross-test-wrapper)'
endif
endif
diff --git a/malloc/tst-mtrace.sh b/malloc/tst-mtrace.sh
index 14b0ad4..90e44c5 100755
--- a/malloc/tst-mtrace.sh
+++ b/malloc/tst-mtrace.sh
@@ -20,12 +20,14 @@
set -e
common_objpfx=$1; shift
+cross_test_wrapper="$1"; shift
status=0
trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+${cross_test_wrapper} \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${common_objpfx}malloc/tst-mtrace || status=1
diff --git a/misc/Makefile b/misc/Makefile
index ea68d26..37d56d8 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -77,9 +77,7 @@ gpl2lgpl := error.c error.h
tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
-ifeq (no,$(cross-compiling))
tests: $(objpfx)tst-error1-mem
-endif
CFLAGS-tsearch.c = $(uses-callbacks)
CFLAGS-lsearch.c = $(uses-callbacks)
diff --git a/nptl/Makefile b/nptl/Makefile
index 184057b..ac94317 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -439,7 +439,7 @@ CFLAGS-tst-initializers1-c99.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
-tst-cancel7-ARGS = --command "$(built-program-cmd)"
+tst-cancel7-ARGS = --command "exec $(local-built-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
tst-umask1-ARGS = $(objpfx)tst-umask1.temp
@@ -448,9 +448,7 @@ LDFLAGS-tst-atfork2 = -rdynamic
tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
$(objpfx)tst-atfork2mod.so: $(shared-thread-library)
-ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-stack3-mem
-endif
tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
$(objpfx)tst-stack3-mem: $(objpfx)tst-stack3.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@
@@ -472,15 +470,14 @@ LDFLAGS-tst-tls5 = $(no-as-needed)
LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
ifeq ($(build-shared),yes)
-ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-tls6.out
-endif
$(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
$(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
$(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
$(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name)
+ $(rtld-installed-name) '$(cross-test-wrapper)' \
+ $(..)scripts/run-with-env.sh
endif
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
@@ -583,18 +580,17 @@ generated += banner.h
LDFLAGS-pthread.so += -e __nptl_main
endif
-ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
tests: $(objpfx)tst-cancel-wrappers.out
$(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
- $(SHELL) $< $(common-objpfx)libc_pic.a \
+ $(SHELL) $< '$(NM)' \
+ $(common-objpfx)libc_pic.a \
$(common-objpfx)libc.a \
$(objpfx)libpthread_pic.a \
$(objpfx)libpthread.a > $@
endif
-endif
-tst-exec4-ARGS = $(built-program-cmd)
+tst-exec4-ARGS = $(local-built-program-cmd)
$(objpfx)tst-execstack: $(libdl)
$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
@@ -602,7 +598,7 @@ LDFLAGS-tst-execstack = -Wl,-z,noexecstack
$(objpfx)tst-fini1mod.so: $(shared-thread-library)
-tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
+tst-stackguard1-ARGS = --command "$(local-built-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
# The tests here better do not run in parallel
diff --git a/nptl/tst-cancel-wrappers.sh b/nptl/tst-cancel-wrappers.sh
index dad2a67..a937efd 100644
--- a/nptl/tst-cancel-wrappers.sh
+++ b/nptl/tst-cancel-wrappers.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# Test whether all cancelable functions are cancelable.
-# Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -18,8 +18,9 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
+nm="$1"; shift
while [ $# -gt 0 ]; do
- ( nm -P $1; echo 'end[end]:' ) | gawk ' BEGIN {
+ ( $nm -P $1; echo 'end[end]:' ) | gawk ' BEGIN {
C["accept"]=1
C["close"]=1
C["connect"]=1
diff --git a/nptl/tst-tls6.sh b/nptl/tst-tls6.sh
index 2622e33..188f69e 100755
--- a/nptl/tst-tls6.sh
+++ b/nptl/tst-tls6.sh
@@ -22,12 +22,15 @@ set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+cross_test_wrapper=$1; shift
+run_with_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="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}/nptl/tst-tls5"
+tst_tls5="$cross_test_wrapper $run_with_env $tst_tls5"
LC_ALL=C
export LC_ALL
@@ -37,36 +40,45 @@ export LANG
> $logfile
fail=0
+preloads ()
+{
+ l=''
+ for s in "$@"; do
+ l="$l ${common_objpfx}nptl/tst-tls5mod$s.so"
+ done
+ echo $l | sed 's/:$//;s/: /:/g'
+}
+
for aligned in a e f; do
echo "preload tst-tls5mod{$aligned,b,c,d}.so" >> $logfile
echo "===============" >> $logfile
- LD_PRELOAD=`echo ${common_objpfx}nptl/tst-tls5mod{$aligned,b,c,d}.so \
- | sed 's/:$//;s/: /:/g'` ${tst_tls5} >> $logfile || fail=1
+ GLIBC_TEST_LD_PRELOAD=`preloads $aligned b c d` \
+ ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{b,$aligned,c,d}.so" >> $logfile
echo "===============" >> $logfile
- LD_PRELOAD=`echo ${common_objpfx}nptl/tst-tls5mod{b,$aligned,c,d}.so \
- | sed 's/:$//;s/: /:/g'` ${tst_tls5} >> $logfile || fail=1
+ GLIBC_TEST_LD_PRELOAD=`preloads b $aligned c d` \
+ ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{b,c,d,$aligned}.so" >> $logfile
echo "===============" >> $logfile
- LD_PRELOAD=`echo ${common_objpfx}nptl/tst-tls5mod{b,c,d,$aligned}.so \
- | sed 's/:$//;s/: /:/g'` ${tst_tls5} >> $logfile || fail=1
+ GLIBC_TEST_LD_PRELOAD=`preloads b c d $aligned` \
+ ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
done
echo "preload tst-tls5mod{d,a,b,c,e}" >> $logfile
echo "===============" >> $logfile
-LD_PRELOAD=`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,c,e}.so \
- | sed 's/:$//;s/: /:/g'` ${tst_tls5} >> $logfile || fail=1
+GLIBC_TEST_LD_PRELOAD=`preloads d a b c e` \
+ ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{d,a,b,e,f}" >> $logfile
echo "===============" >> $logfile
-LD_PRELOAD=`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,e,f}.so \
- | sed 's/:$//;s/: /:/g'` ${tst_tls5} >> $logfile || fail=1
+GLIBC_TEST_LD_PRELOAD=`preloads d a b e f` \
+ ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
exit $fail
diff --git a/posix/Makefile b/posix/Makefile
index 182c120..2c0c9ec 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -112,17 +112,15 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
include ../Rules
-ifeq (no,$(cross-compiling))
# globtest and wordexp-test currently only works with shared libraries
ifeq (yes,$(build-shared))
tests: $(objpfx)globtest.out $(objpfx)wordexp-tst.out
$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name)
+ $(rtld-installed-name) '$(cross-test-wrapper)'
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name)
-endif
+ $(rtld-installed-name) '$(cross-test-wrapper)'
endif
# If we will use the generic uname implementation, we must figure out what
@@ -171,8 +169,8 @@ CFLAGS-execlp.os = -fomit-frame-pointer
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
-tst-exec-ARGS = -- $(built-program-cmd)
-tst-spawn-ARGS = -- $(built-program-cmd)
+tst-exec-ARGS = -- $(local-built-program-cmd)
+tst-spawn-ARGS = -- $(local-built-program-cmd)
tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
tst-chmod-ARGS = $(objdir)
tst-vfork3-ARGS = --test-dir=$(objpfx)
@@ -213,13 +211,11 @@ ptestcases.h: PTESTS PTESTS2C.sed
# Run a test on the header files we use.
# XXX Please note that for now we ignore the result of this test.
tests: $(objpfx)annexc.out
-ifeq (no,$(cross-compiling))
tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
$(objpfx)bug-regex21-mem $(objpfx)bug-regex31-mem $(objpfx)tst-rxspencer-mem\
$(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
$(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem $(objpfx)tst-fnmatch-mem
xtests: $(objpfx)bug-ga2-mem
-endif
$(objpfx)annexc.out: $(objpfx)annexc
-$(dir $<)$(notdir $<) '$(CC)' \
@@ -277,7 +273,8 @@ $(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@
$(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
- $(SHELL) $< $(common-objpfx) $(elf-objpfx) $(rtld-installed-name)
+ $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
+ '$(cross-test-wrapper)' $(rtld-installed-name)
ifeq (yes,$(build-shared))
$(objpfx)tst-regex: $(common-objpfx)rt/librt.so
diff --git a/posix/globtest.sh b/posix/globtest.sh
index 286b1b4..1df0ef7 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -22,6 +22,7 @@ set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+cross_test_wrapper=$1; shift
logfile=$common_objpfx/posix/globtest.out
#CMP=cmp
@@ -39,6 +40,9 @@ esac
# We have to find the libc and the NSS modules.
library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
+run_program_prefix="${cross_test_wrapper} \
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path}"
+
# Since we use `sort' we must make sure to use the same locale everywhere.
LC_ALL=C
export LC_ALL
@@ -78,7 +82,7 @@ rm -f $logfile
# Normal test
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -105,7 +109,7 @@ fi
# Don't let glob sort it
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -s "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -132,7 +136,7 @@ fi
# Mark directories
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -m "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -159,7 +163,7 @@ fi
# Find files starting with .
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -p "$testdir" "*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -189,7 +193,7 @@ fi
# Test braces
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -202,7 +206,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -216,7 +220,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" "{" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -229,7 +233,7 @@ fi
# Test NOCHECK
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" "abc" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -242,7 +246,7 @@ fi
# Test NOMAGIC without magic characters
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -g "$testdir" "abc" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -255,7 +259,7 @@ fi
# Test NOMAGIC with magic characters
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -g "$testdir" "abc*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -268,7 +272,7 @@ fi
# Test NOMAGIC for subdirs
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -281,7 +285,7 @@ fi
# Test subdirs correctly
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -297,7 +301,7 @@ fi
# Test subdirs for invalid names
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/1" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -310,7 +314,7 @@ fi
# Test subdirs with wildcard
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -324,7 +328,7 @@ fi
# Test subdirs with ?
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -339,7 +343,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -352,7 +356,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*-/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -364,7 +368,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*-" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -377,7 +381,7 @@ fi
# Test subdirs with ?
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -393,7 +397,7 @@ fi
# Test subdirs with [ .. ]
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -409,7 +413,7 @@ fi
# Test ']' inside bracket expression
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -423,7 +427,7 @@ fi
# Test tilde expansion
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -q -t "$testdir" "~" |
sort >$testout
echo ~ | $CMP - $testout >> $logfile || failed=1
@@ -438,7 +442,7 @@ fi
# Test tilde expansion with trailing slash
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
sort > $testout
# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
@@ -458,7 +462,7 @@ fi
# Test tilde expansion with username
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
sort > $testout
eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
@@ -473,7 +477,7 @@ fi
# Tilde expansion shouldn't match a file
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -T "$testdir" "~file4" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -486,7 +490,7 @@ fi
# Matching \** should only find *file6
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "\**" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -500,7 +504,7 @@ fi
# ... unless NOESCAPE is used, in which case it should entries with a
# leading \.
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -e "$testdir" "\**" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -515,7 +519,7 @@ fi
# Matching \*file6 should find *file6
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "\*file6" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -528,7 +532,7 @@ fi
# GLOB_BRACE alone
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -541,7 +545,7 @@ fi
# GLOB_BRACE and GLOB_NOESCAPE
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -554,7 +558,7 @@ fi
# Escaped comma
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -567,7 +571,7 @@ fi
# Escaped closing brace
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -580,7 +584,7 @@ fi
# Try a recursive failed search
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -593,7 +597,7 @@ fi
# ... with GLOB_ERR
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -606,7 +610,7 @@ fi
# Try a recursive search in unreadable directory
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "noread/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -618,7 +622,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "noread*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -636,14 +640,14 @@ if test -z "$user"; then
fi
if test "$user" != root; then
# ... with GLOB_ERR
- ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${run_program_prefix} \
${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
GLOB_ABORTED
EOF
- ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${run_program_prefix} \
${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -657,7 +661,7 @@ fi # not run as root
# Try multiple patterns (GLOB_APPEND)
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -674,7 +678,7 @@ fi
# Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -692,7 +696,7 @@ fi
# Test NOCHECK with non-existing file in subdir.
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -705,7 +709,7 @@ fi
# Test [[:punct:]] not matching leading period.
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
sort > $testout
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
@@ -734,10 +738,10 @@ mkdir $testdir/dir6
echo 6 > $testdir/dir6/'file1[a'
echo 7 > $testdir/dir6/'file1[ab]'
failed=0
-v=`${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+v=`${run_program_prefix} \
${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
${common_objpfx}posix/globtest -c "$testdir" \
'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \
'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \
@@ -761,7 +765,8 @@ cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
`dir6/file1[ab]'
`nondir\/'
EOF
-HOME="$testdir" \
+${cross_test_wrapper} \
+env HOME="$testdir" \
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -ct "$testdir" \
'~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
@@ -777,15 +782,15 @@ EOF
if eval test -d ~"$USER"/; then
user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'`
if test -n "$user"; then
- ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${run_program_prefix} \
${common_objpfx}posix/globtest -ctq "$testdir" "$user/" |
sort > $testout
eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
- ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${run_program_prefix} \
${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" |
sort > $testout
eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
- ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${run_program_prefix} \
${common_objpfx}posix/globtest -ctq "$testdir" "$user" |
sort > $testout
eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
diff --git a/posix/tst-getconf.sh b/posix/tst-getconf.sh
index 030926a..a9a222b 100644
--- a/posix/tst-getconf.sh
+++ b/posix/tst-getconf.sh
@@ -21,14 +21,17 @@ set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
+cross_test_wrapper=$1; shift
if [ $# -eq 0 ]; then
# Static case.
runit() {
+ ${cross_test_wrapper} \
"$@"
}
else
rtld_installed_name=$1; shift
runit() {
+ ${cross_test_wrapper} \
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
}
fi
@@ -45,7 +48,10 @@ rm -f $logfile
result=0
while read name; do
echo -n "getconf $name: " >> $logfile
- runit ${common_objpfx}posix/getconf "$name" 2>> $logfile >> $logfile
+ # Redirect input from /dev/null in case runit consumes input when it
+ # shouldn't (ssh, say)
+ runit ${common_objpfx}posix/getconf "$name" \
+ < /dev/null 2>> $logfile >> $logfile
if test $? -ne 0; then
echo "*** $name FAILED" >> $logfile
result=1
@@ -223,7 +229,10 @@ EOF
while read name; do
echo -n "getconf $name /: " >> $logfile
- runit ${common_objpfx}posix/getconf "$name" / 2>> $logfile >> $logfile
+ # Redirect input from /dev/null in case runit consumes input when it
+ # shouldn't (ssh, say)
+ runit ${common_objpfx}posix/getconf "$name" / \
+ < /dev/null 2>> $logfile >> $logfile
if test $? -ne 0; then
echo "*** $name FAILED" >> $logfile
result=1
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index fec5292..55116aa 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -26,6 +26,11 @@ set -e
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+cross_test_wrapper=$1; shift
+
+run_program_prefix="${cross_test_wrapper} \
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx}"
+
logfile=${common_objpfx}posix/wordexp-tst.out
testout=${common_objpfx}posix/wordexp-test-result
@@ -39,7 +44,7 @@ IFS=" \
export IFS
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
wordexp returned 0
@@ -51,7 +56,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
wordexp returned 0
@@ -64,7 +69,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
wordexp returned 0
@@ -77,7 +82,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
wordexp returned 0
@@ -89,7 +94,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
wordexp returned 0
@@ -103,7 +108,7 @@ fi
# Why? Because bash does it that way..
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
wordexp returned 0
@@ -115,7 +120,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${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
@@ -130,7 +135,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${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
@@ -142,7 +147,7 @@ if test $failed -ne 0; then
fi
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
wordexp returned 0
@@ -155,7 +160,7 @@ if test $failed -ne 0; then
status=1
fi
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${run_program_prefix} \
${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
cat <<"EOF" | cmp - ${testout}10 || failed=1
wordexp returned 0
diff --git a/resolv/Makefile b/resolv/Makefile
index 4777317..af7257f 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -108,17 +108,13 @@ $(objpfx)tst-leaks: $(objpfx)libresolv.so
tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
$(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
-ifeq (no,$(cross-compiling))
ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-leaks
endif
-endif
tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace
$(objpfx)mtrace-tst-leaks2: $(objpfx)tst-leaks2.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@
-ifeq (no,$(cross-compiling))
ifneq (no,$(PERL))
xtests: $(objpfx)mtrace-tst-leaks2
endif
-endif
diff --git a/rt/Makefile b/rt/Makefile
index 941c471..9b9f599 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -77,4 +77,4 @@ ifeq (yes,$(build-bounded))
$(tests:%=$(objpfx)%-bp): $(objpfx)librt_b.a $(bounded-thread-library)
endif
-tst-mqueue7-ARGS = -- $(built-program-cmd)
+tst-mqueue7-ARGS = -- $(local-built-program-cmd)
diff --git a/scripts/cross-test-ssh.sh b/scripts/cross-test-ssh.sh
new file mode 100755
index 0000000..e321c28
--- /dev/null
+++ b/scripts/cross-test-ssh.sh
@@ -0,0 +1,156 @@
+#! /bin/bash
+# Run a testcase on a remote system, via ssh.
+# Copyright (C) 2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+# usage: cross-test-ssh.sh [--ssh SSH] HOST COMMAND ...
+# 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.
+
+If the '--ssh SSH' flag is present, use SSH as the SSH command,
+instead of ordinary 'ssh'.
+
+To use this to run glibc tests, invoke the tests as follows:
+
+ $ make cross-test-wrapper='ABSPATH/cross-test-ssh.sh HOST' tests
+
+where ABSPATH is the absolute path to this script, and HOST is the
+name of the machine to connect to via ssh.
+
+If you need to connect to the test machine as a different user, you
+may specify that just as you would to SSH:
+
+ $ make cross-test-wrapper='ABSPATH/cross-test-ssh.sh USER@HOST' tests
+
+Naturally, the remote user must have an appropriate public key, and
+you will want to ensure that SSH does not prompt interactively for a
+password on each connection.
+
+HOST and the build machines (on which 'make check' is being run) must
+share a filesystem; all files needed by the tests must be visible at
+the same paths on both machines.
+
+${progname} runs COMMAND in the same directory on the HOST that
+${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}"
+
+ssh='ssh'
+while true; do
+ case "$1" in
+
+ "--ssh")
+ shift; ssh="$1"
+ ;;
+
+ "--help")
+ echo "$usage"
+ echo "$help"
+ exit 0
+ ;;
+
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+if [ $# -lt 1 ]; then
+ echo "$usage" >&2
+ echo "Type '${progname} --help' for more detailed help." >&2
+ exit 1
+fi
+
+host="$1"; shift
+
+# Return all input as a properly quoted Bourne shell string.
+bourne_quote ()
+{
+ printf '%s' '"'
+ sed -n \
+ -e '1h' \
+ -e '2,$H' \
+ -e '${g
+ s/["$\`]/\\&/g
+ p
+ }'
+ printf '%s' '"'
+}
+
+# Remove unnecessary newlines from a Bourne shell command sequence.
+remove_newlines ()
+{
+ sed -n \
+ -e '1h' \
+ -e '2,$H' \
+ -e '${g
+ s/\([^\]\)\n/\1; /g
+ p
+ }'
+}
+
+# Unset all variables from the blacklist. Then echo all exported
+# variables. This should be run in a subshell. The 'export -p'
+# command adds backslashes for environment variables which contain
+# newlines.
+blacklist_exports ()
+{
+ local var
+ for var in ${env_blacklist}; do
+ unset $var
+ done
+ export -p
+}
+
+# Produce properly quoted Bourne shell arguments for 'env' to carry
+# over the current environment, less blacklisted variables.
+exports="$( (blacklist_exports) | sed -e 's|^declare -x |export |')"
+
+# Transform the current argument list into a properly quoted Bourne shell
+# command string.
+command="$(for word in "$@"; do
+ printf '%s' "$word" | bourne_quote
+ printf '%s' ' '
+ done)"
+
+# Add commands to set environment variables and the current directory.
+command="${exports}
+cd $PWD
+${command}"
+
+# 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
+# the sole argument of the '-c' option.
+full_command="$(printf '%s\n' "${command}" | bourne_quote | remove_newlines)"
+$ssh "$host" /bin/sh -c "$full_command"
diff --git a/scripts/run-with-env.sh b/scripts/run-with-env.sh
new file mode 100755
index 0000000..390b682
--- /dev/null
+++ b/scripts/run-with-env.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Execute commands with environment variables set at the last minute.
+# Copyright (C) 2012 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+# Usage: run-with-env.sh CMD ...
+# For certain environment variable whose names are of the form
+# 'GLIBC_TEST_foo', if they are set, we set an environment variable
+# 'foo' to their value.
+#
+# This lets us run test programs via wrappers with environment
+# variable settings that would otherwise interfere with the wrapper
+# itself, like LD_PRELOAD or LD_AUDIT.
+
+if [ "${GLIBC_TEST_LD_PRELOAD+set}" ]; then
+ export LD_PRELOAD="${GLIBC_TEST_LD_PRELOAD}"
+fi
+
+if [ "${GLIBC_TEST_LD_AUDIT+set}" ]; then
+ export LD_AUDIT="${GLIBC_TEST_LD_AUDIT}"
+fi
+
+if [ "${GLIBC_TEST_LD_LIBRARY_PATH+set}" ]; then
+ export LD_LIBRARY_PATH="${GLIBC_TEST_LD_LIBRARY_PATH}"
+fi
+
+if [ "${GLIBC_TEST_LD_TRACE_LOADED_OBJECTS+set}" ]; then
+ export LD_TRACE_LOADED_OBJECTS="${GLIBC_TEST_LD_TRACE_LOADED_OBJECTS}"
+fi
+
+if [ "${GLIBC_TEST_LD_DEBUG+set}" ]; then
+ export LD_DEBUG="${GLIBC_TEST_LD_DEBUG}"
+fi
+
+exec "$@"
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 5e2e48d..6cc5ed3 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -63,7 +63,6 @@ test-srcs = tst-unbputc tst-printf
include ../Rules
-ifeq ($(cross-compiling),no)
.PHONY: do-tst-unbputc do-tst-printf
tests: do-tst-unbputc do-tst-printf
@@ -74,7 +73,6 @@ $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
do-tst-printf: $(objpfx)tst-printf.out
$(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
-endif
CFLAGS-vfprintf.c = -Wno-uninitialized
CFLAGS-vfwprintf.c = -Wno-uninitialized
diff --git a/stdlib/Makefile b/stdlib/Makefile
index a5318ee..599170b 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -122,9 +122,7 @@ bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
# Run a test on the header files we use.
tests: $(objpfx)isomac.out
-ifeq (no,$(cross-compiling))
tests: $(objpfx)tst-fmtmsg.out
-endif
$(objpfx)isomac.out: $(objpfx)isomac
$(dir $<)$(notdir $<) '$(CC)' \
diff --git a/string/Makefile b/string/Makefile
index 8d1db74..1425e41 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -76,10 +76,8 @@ CFLAGS-tst-inlcall.c = -fno-builtin
CFLAGS-bug-strstr1.c = -fno-builtin
CFLAGS-bug-strcasestr1.c = -fno-builtin
-ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-svc.out
$(objpfx)tst-svc.out: tst-svc.input $(objpfx)tst-svc
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
$(built-program-cmd) < $(word 1,$^) > $@
@cmp tst-svc.expect $(objpfx)tst-svc.out
-endif
--
Joseph S. Myers
joseph@codesourcery.com