This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Support cross-testing (version 2)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Tue, 23 Oct 2012 15:54:09 +0000
- Subject: Support cross-testing (version 2)
Here is a second version of the cross-testing changes. This is
relative to a tree with the three pending patches
<http://sourceware.org/ml/libc-alpha/2012-10/msg00605.html>,
<http://sourceware.org/ml/libc-alpha/2012-10/msg00606.html> and
<http://sourceware.org/ml/libc-alpha/2012-10/msg00582.html> applied; I
don't think there's really much more that can usefully be split out
into separate patches.
The basic idea of testing via "make check
cross-test-wrapper=some-wrapper-command" is unchanged from the first
version <http://sourceware.org/ml/libc-alpha/2012-10/msg00479.html>,
but I've avoided the need for run-with-env.sh and lots of associated
changes by using the "env" command, run on glibc's host system, to set
environment variables in most cases, rather than requiring them all to
be set on the build system and then passed across from there (see the
change to the defintion of make-test-out). This breaks the way
nptl/tst-oddstacklimit used the -ENV variables to include a command
("tst-oddstacklimit-ENV = ; ulimit -s 1023;"), so I changed that to
use a custom makefile target (since there's just the single test doing
that). Carlos, you'll need to work out how to adjust the way
ports/sysdeps/hppa/nptl/Makefile overrode the definition of
tst-oddstacklimit-ENV (maybe through moving the limit out to its own
variable that sysdeps makefiles can override).
Tested x86_64 (native testing), and with cross to powerpc-linux-gnu
(testing over ssh).
2012-10-23 Jim Blandy <jimb@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* Makeconfig (run-program-prefix): Use $(cross-test-wrapper).
(built-program-cmd): Likewise.
* Rules [$(cross-compiling) = yes]: Remove conditional code.
[$(cross-compiling) != yes]: Make code unconditional.
(make-test-out): Use $(cross-test-wrapper) and
$(local-built-program-cmd). Use "env" to set environment
variables.
* catgets/Makefile [$(cross-compiling) != yes]: Make code
unconditional.
* elf/Makefile [$(cross-compiling) = no]: Make code unconditional.
($(objpfx)order.out): Use $(cross-test-wrapper).
($(objpfx)tst-pathopt.out): Pass $(cross-test-wrapper) to
tst-pathopt.sh.
($(objpfx)tst-rtld-load-self.out): Pass $(cross-test-wrapper) to
tst-rtld-load-self.sh.
($(objpfx)order2.out): Use $(cross-test-wrapper).
($(objpfx)tst-initorder.out): Likewise.
($(objpfx)tst-initorder2.out): Likewise.
($(objpfx)tst-unused-dep.out): Use $(cross-test-wrapper). Use
"env" to set environment variables.
* elf/tst-pathopt.sh (run_program_prefix): Remove unused variable.
(cross_test_wrapper): New variable. Use it to run ld.so, setting
environment variables with "env".
* elf/tst-rtld-load-self.sh (cross_test_wrapper): New variable.
Use it to run ld.so.
* grp/Makefile [$(cross-compiling) = no]: Make code unconditional.
* 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.
* iconvdata/run-iconv-test.sh (cross_test_wrapper): New variable.
(ICONV): Use $cross_test_wrapper.
* intl/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* io/Makefile [$(cross-compiling) = no]: Make code unconditional.
* libio/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* malloc/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* 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.
* posix/globtest.sh (cross_test_wrapper): New variable. Use it to
run program with HOME set via "env".
(run_program_prefix): Use $cross_test_wrapper.
(TMPDIR): Do not set.
(testdir): Define using `pwd` not $TMPDIR.
(testout): Likewise.
* resolv/Makefile [$(cross-compiling) = no]: Make code
unconditional.
* scripts/cross-test-ssh.sh: New file.
* 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.
localedata:
2012-10-23 Jim Blandy <jimb@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* Makefile [$(cross-compiling) = no]: Make code unconditional.
nptl:
2012-10-23 Jim Blandy <jimb@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* Makefile [$(cross-compiling) = no]: Make code unconditional.
(tests): Remove tst-oddstacklimit.
(test-srcs): New variable.
(tst-oddstacklimit-ENV): Remove.
(tests): Depend on $(objpfx)tst-oddstacklimit.out.
($(objpfx)tst-oddstacklimit.out): New target.
($(objpfx)tst-tls6.out): Pass $(cross-test-wrapper) to
tst-tls6.sh.
* tst-tls6.sh (cross_test_wrapper): New variable. Use it to run
programs with LD_PRELOAD set via "env".
diff --git a/Makeconfig b/Makeconfig
index 910065f..6ece02f 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -591,12 +591,13 @@ endif
# 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 = $(run-via-rtld-prefix)
+run-program-prefix = $(cross-test-wrapper) $(run-via-rtld-prefix)
# $(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 = $(run-via-rtld-prefix) $(built-program-file)
+built-program-cmd = $(cross-test-wrapper) \
+ $(run-via-rtld-prefix) $(built-program-file)
# $(local-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
diff --git a/Rules b/Rules
index 5e33610..a2a70ff 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)
@@ -180,8 +175,9 @@ ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
# These are the implicit rules for making test outputs
# from the test programs and whatever input files are present.
-make-test-out = GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
- $($*-ENV) $(built-program-cmd) $($*-ARGS)
+make-test-out = $(cross-test-wrapper) \
+ env GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+ $($*-ENV) $(local-built-program-cmd) $($*-ARGS)
$(objpfx)%-bp.out: %.input $(objpfx)%-bp
$(make-test-out) > $@ < $(word 1,$^)
$(objpfx)%.out: %.input $(objpfx)%
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/elf/Makefile b/elf/Makefile
index 3b2637a..084295c 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -161,10 +161,8 @@ tests += tst-audit6 tst-audit7
endif
endif
endif
-ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-leaks1-mem $(objpfx)tst-leaks1-static-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))
@@ -438,10 +436,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)
@@ -644,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 > $@
@@ -710,10 +707,10 @@ $(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)'
$(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
- $(SHELL) $^ > $@
+ $(SHELL) $^ '$(cross-test-wrapper)' > $@
$(objpfx)initfirst: $(libdl)
$(objpfx)initfirst.out: $(objpfx)firstobj.so
@@ -1035,6 +1032,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 > $@
@@ -1129,6 +1127,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)) \
$< > $@
@@ -1150,6 +1149,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)) \
$< > $@
@@ -1174,11 +1174,11 @@ $(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
+ $(cross-test-wrapper) \
+ env \
LD_TRACE_LOADED_OBJECTS=1 \
LD_DEBUG=unused \
LD_PRELOAD= \
diff --git a/elf/tst-pathopt.sh b/elf/tst-pathopt.sh
index 048c612..ba9ec4f 100755
--- a/elf/tst-pathopt.sh
+++ b/elf/tst-pathopt.sh
@@ -20,7 +20,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+cross_test_wrapper=$2
test -e ${common_objpfx}elf/will-be-empty &&
rm -fr ${common_objpfx}elf/will-be-empty
@@ -29,6 +29,7 @@ test -d ${common_objpfx}elf/for-renamed ||
cp ${common_objpfx}elf/pathoptobj.so ${common_objpfx}elf/for-renamed/renamed.so
+${cross_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 \
${common_objpfx}elf/ld.so ${common_objpfx}elf/tst-pathopt \
diff --git a/elf/tst-rtld-load-self.sh b/elf/tst-rtld-load-self.sh
index f4c5dea..7201dfc 100755
--- a/elf/tst-rtld-load-self.sh
+++ b/elf/tst-rtld-load-self.sh
@@ -21,25 +21,27 @@
set -e
rtld=$1
+cross_test_wrapper=$2
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=$?
+${cross_test_wrapper} env LD_TRACE_LOADED_OBJECTS=1 \
+ $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 1988cbf..7211942 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -50,7 +50,6 @@ 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
@@ -58,4 +57,3 @@ $(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
endif
-endif
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 cf6cf70..adaa754 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,7 +297,7 @@ $(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)) \
diff --git a/iconvdata/run-iconv-test.sh b/iconvdata/run-iconv-test.sh
index cb9f5df..01886b0 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
diff --git a/intl/Makefile b/intl/Makefile
index 5bf6606..49240c1 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 \
@@ -91,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/io/Makefile b/io/Makefile
index 9601a6f..a60da3c 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -98,9 +98,7 @@ 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
$(objpfx)ftwtest.out: ftwtest-sh $(objpfx)ftwtest
$(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@
-endif
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/malloc/Makefile b/malloc/Makefile
index 9dd0336..05b776f 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -104,7 +104,6 @@ $(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
@@ -112,7 +111,6 @@ $(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
endif
endif
-endif
tst-mcheck-ENV = MALLOC_CHECK_=3
tst-malloc-usable-ENV = MALLOC_CHECK_=3
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 e79451a..17174b2 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -257,20 +257,16 @@ tests = tst-typesizes \
tst-context1 \
tst-sched1 \
tst-backtrace1 \
- tst-oddstacklimit \
tst-abstime \
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
tst-getpid1 tst-getpid2 tst-getpid3 \
tst-initializers1 $(patsubst %,tst-initializers1-%,c89 gnu89 c99 gnu99)
xtests = tst-setuid1 tst-setuid1-static tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
+test-srcs = tst-oddstacklimit
# Files which must not be linked with libpthread.
tests-nolibpthread = tst-unload
-# This sets the stack resource limit to 1023kb, which is not a multiple
-# of the page size since every architecture's page size is > 1k.
-tst-oddstacklimit-ENV = ; ulimit -s 1023;
-
gen-as-const-headers = pthread-errnos.sym
LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
@@ -448,9 +444,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 +466,13 @@ 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)'
endif
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
@@ -583,7 +575,6 @@ 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
@@ -593,7 +584,6 @@ $(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
$(objpfx)libpthread_pic.a \
$(objpfx)libpthread.a > $@
endif
-endif
tst-exec4-ARGS = $(local-built-program-cmd)
@@ -606,6 +596,14 @@ $(objpfx)tst-fini1mod.so: $(shared-thread-library)
tst-stackguard1-ARGS = --command "$(local-built-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
+tests: $(objpfx)tst-oddstacklimit.out
+
+# This sets the stack resource limit to 1023kb, which is not a multiple
+# of the page size since every architecture's page size is > 1k.
+$(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit
+ $(cross-test-wrapper) \
+ sh -c 'ulimit -s 1023; $(run-via-rtld-prefix) $^' > $@
+
# The tests here better do not run in parallel
ifneq ($(filter %tests,$(MAKECMDGOALS)),)
.NOTPARALLEL:
diff --git a/nptl/tst-tls6.sh b/nptl/tst-tls6.sh
index 2622e33..67e4845 100755
--- a/nptl/tst-tls6.sh
+++ b/nptl/tst-tls6.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/nptl/tst-tls6.out
# We have to find libc and nptl
@@ -40,33 +41,38 @@ fail=0
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
+ ${cross_test_wrapper} env \
+ LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{$aligned,b,c,d}.so \
+ | sed 's/:$//;s/: /:/g'`" ${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
+ ${cross_test_wrapper} env \
+ LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{b,$aligned,c,d}.so \
+ | sed 's/:$//;s/: /:/g'`" ${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
+ ${cross_test_wrapper} env \
+ LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{b,c,d,$aligned}.so \
+ | sed 's/:$//;s/: /:/g'`" ${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
+${cross_test_wrapper} env \
+LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,c,e}.so \
+ | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
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
+${cross_test_wrapper} env \
+LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,e,f}.so \
+ | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
exit $fail
diff --git a/posix/Makefile b/posix/Makefile
index b877dcb..f2f6b67 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -112,16 +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) '$(run-via-rtld-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(run-via-rtld-prefix)' \
+ '$(cross-test-wrapper)'
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
endif
-endif
# If we will use the generic uname implementation, we must figure out what
# it will say by examining the system, and write the results in config-name.h.
@@ -211,13 +210,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)' \
diff --git a/posix/globtest.sh b/posix/globtest.sh
index c8a13e5..f05e110 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -21,7 +21,8 @@ set -e
common_objpfx=$1; shift
run_via_rtld_prefix=$1; shift
-run_program_prefix=$run_via_rtld_prefix
+cross_test_wrapper=$1; shift
+run_program_prefix="$cross_test_wrapper $run_via_rtld_prefix"
logfile=$common_objpfx/posix/globtest.out
#CMP=cmp
@@ -43,9 +44,8 @@ LANG=C
export LANG
# Create the arena
-: ${TMPDIR=/tmp}
-testdir=$(mktemp -d $TMPDIR/globtest-dir.XXXXXX)
-testout=$(mktemp $TMPDIR/globtest-out.XXXXXX)
+testdir=$(mktemp -d `pwd`/globtest-dir.XXXXXX)
+testout=$(mktemp `pwd`/globtest-out.XXXXXX)
trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
@@ -758,7 +758,8 @@ cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
`dir6/file1[ab]'
`nondir\/'
EOF
-HOME="$testdir" \
+${cross_test_wrapper} \
+env HOME="$testdir" \
${run_via_rtld_prefix} \
${common_objpfx}posix/globtest -ct "$testdir" \
'~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
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/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/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 54eae70..4418fd9 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -78,10 +78,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