aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog39
-rw-r--r--Makeconfig19
-rw-r--r--Rules5
-rw-r--r--elf/Makefile9
-rwxr-xr-xelf/tst-pathopt.sh3
-rwxr-xr-xelf/tst-rtld-load-self.sh11
-rw-r--r--iconvdata/Makefile2
-rwxr-xr-xiconvdata/run-iconv-test.sh2
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/Makefile2
-rwxr-xr-xnptl/tst-tls6.sh26
-rw-r--r--posix/Makefile3
-rwxr-xr-xposix/globtest.sh8
13 files changed, 110 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 28f485a..a62630f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2012-10-24 Joseph Myers <joseph@codesourcery.com>
+ Jim Blandy <jimb@codesourcery.com>
+
+ * Makeconfig (test-wrapper): New variable,
+ (test-wrapper-env): Likewise.
+ [$(cross-compiling) = yes && $(test-wrapper) != ""]
+ (run-built-tests): Define to yes.
+ (run-program-prefix): Use $(test-wrapper).
+ (built-program-cmd): Likewise.
+ * Rules (make-test-out): Use $(test-wrapper-env) and
+ $(host-built-program-cmd).
+ * elf/Makefile ($(objpfx)order.out): Use $(test-wrapper).
+ ($(objpfx)tst-pathopt.out): Pass $(test-wrapper-env) to
+ tst-pathopt.sh.
+ ($(objpfx)tst-rtld-load-self.out): Pass $(test-wrapper) and
+ $(test-wrapper-env) to tst-rtld-load-self.sh.
+ ($(objpfx)order2.out): Use $(test-wrapper).
+ ($(objpfx)tst-initorder.out): Likewise.
+ ($(objpfx)tst-initorder2.out): Likewise.
+ ($(objpfx)tst-unused-dep.out): Use $(test-wrapper-env).
+ * elf/tst-pathopt.sh (run_program_prefix): Remove unused variable.
+ (test_wrapper_env): New variable. Use it to run ld.so.
+ * elf/tst-rtld-load-self.sh (test_wrapper): New variable.
+ Use it to run ld.so.
+ (test_wrapper_env): Likewise.
+ * iconvdata/Makefile ($(objpfx)iconv-test.out): Pass
+ $(test-wrapper) to run-iconv-test.sh.
+ * iconvdata/run-iconv-test.sh (test_wrapper): New variable.
+ (ICONV): Use $test_wrapper.
+ * posix/Makefile ($(objpfx)globtest.out): Pass
+ $(run-via-rtld-prefix), $(test-wrapper) and $(test-wrapper-env) to
+ globtest.sh, not $(run-program-prefix).
+ * posix/globtest.sh (run_via_rtld_prefix): New variable.
+ (test_wrapper): Likewise.
+ (test_wrapper_env): Likewise. Use it to run globtest with HOME
+ set together with run_via_rtld_prefix.
+ (run_program_prefix): Define in terms of test_wrapper and
+ run_via_rtld_prefix.
+
2012-10-24 Roland McGrath <roland@hack.frob.com>
* nscd/Makefile ($(objpfx)nscd): Remove librt dependency.
diff --git a/Makeconfig b/Makeconfig
index 1b1604a..2b9e735 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -564,9 +564,21 @@ endif
csu-objpfx = $(common-objpfx)csu/
elf-objpfx = $(common-objpfx)elf/
+# A command that, prepended to the name and arguments of a program,
+# and run on the build system, causes that program with those
+# arguments to be run on the host for which the library is built.
+ifndef test-wrapper
+test-wrapper =
+endif
+# Likewise, but the name of the program is preceded by
+# <variable>=<value> assignments for environment variables.
+ifndef test-wrapper-env
+test-wrapper-env = $(test-wrapper) env
+endif
+
# Whether to run test programs built for the library's host system.
ifndef run-built-tests
-ifeq (yes,$(cross-compiling))
+ifeq (yes|,$(cross-compiling)|$(test-wrapper))
run-built-tests = no
else
run-built-tests = yes
@@ -600,12 +612,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 = $(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 = $(test-wrapper) \
+ $(run-via-rtld-prefix) $(built-program-file)
# $(host-built-program-cmd) is a command that, executed on the host
# for which the library is built, runs the newly built program that is
# the second dependency of the makefile target in which
diff --git a/Rules b/Rules
index db5bad0..35e6ce0 100644
--- a/Rules
+++ b/Rules
@@ -180,8 +180,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 = $(test-wrapper-env) \
+ GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+ $($*-ENV) $(host-built-program-cmd) $($*-ARGS)
$(objpfx)%-bp.out: %.input $(objpfx)%-bp
$(make-test-out) > $@ < $(word 1,$^)
$(objpfx)%.out: %.input $(objpfx)%
diff --git a/elf/Makefile b/elf/Makefile
index 4f092ab..f539f13 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -644,6 +644,7 @@ $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
$(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
$(objpfx)order.out: $(objpfx)order
+ $(test-wrapper) \
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(objpfx)order > $@
@@ -710,10 +711,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) '$(test-wrapper-env)'
$(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
- $(SHELL) $^ > $@
+ $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@
$(objpfx)initfirst: $(libdl)
$(objpfx)initfirst.out: $(objpfx)firstobj.so
@@ -1035,6 +1036,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
+ $(test-wrapper) \
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(objpfx)order2 > $@
@@ -1129,6 +1131,7 @@ $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
+ $(test-wrapper) \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
@@ -1150,6 +1153,7 @@ object-suffixes-left := a b c d
include $(o-iterator)
$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
+ $(test-wrapper) \
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$< > $@
@@ -1179,6 +1183,7 @@ tests: $(objpfx)tst-unused-dep.out
endif
$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
+ $(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..2f8bfc6 100755
--- a/elf/tst-pathopt.sh
+++ b/elf/tst-pathopt.sh
@@ -20,7 +20,7 @@
set -e
common_objpfx=$1
-run_program_prefix=$2
+test_wrapper_env=$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
+${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..18723a9 100755
--- a/elf/tst-rtld-load-self.sh
+++ b/elf/tst-rtld-load-self.sh
@@ -21,25 +21,28 @@
set -e
rtld=$1
+test_wrapper=$2
+test_wrapper_env=$3
result=0
echo '# normal mode'
-$rtld $rtld 2>&1 && rc=0 || rc=$?
+${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=$?
+${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=$?
+${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=$?
+${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/iconvdata/Makefile b/iconvdata/Makefile
index 89f0dcd..2840cff 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -299,7 +299,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) '$(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..ec8f024 100755
--- a/iconvdata/run-iconv-test.sh
+++ b/iconvdata/run-iconv-test.sh
@@ -21,6 +21,7 @@
set -e
codir=$1
+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="$test_wrapper $ICONV"
# Which echo?
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index d0b5d6c..040b64c 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-24 Joseph Myers <joseph@codesourcery.com>
+ Jim Blandy <jimb@codesourcery.com>
+
+ * Makefile ($(objpfx)tst-tls6.out): Pass $(test-wrapper-env) to
+ tst-tls6.sh.
+ * tst-tls6.sh (test_wrapper_env): New variable. Use it to run
+ programs with LD_PRELOAD set.
+
2012-10-24 Roland McGrath <roland@hack.frob.com>
* Makefile ($(objpfx)tst-cond11, $(objpfx)tst-cond19): Targets removed.
diff --git a/nptl/Makefile b/nptl/Makefile
index 7387a64..f84646e 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -476,7 +476,7 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
$(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
$(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
- $(rtld-installed-name)
+ $(rtld-installed-name) '$(test-wrapper-env)'
endif
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
diff --git a/nptl/tst-tls6.sh b/nptl/tst-tls6.sh
index 2622e33..6ef1232 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
+test_wrapper_env=$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
+ ${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
+ ${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
+ ${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
+${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
+${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 add2ca5..853152e 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -117,7 +117,8 @@ ifeq ($(run-built-tests),yes)
ifeq (yes,$(build-shared))
tests: $(objpfx)globtest.out $(objpfx)wordexp-tst.out
$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(run-via-rtld-prefix)' \
+ '$(test-wrapper)' '$(test-wrapper-env)'
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
endif
diff --git a/posix/globtest.sh b/posix/globtest.sh
index ea947b8..121be85 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -20,7 +20,10 @@
set -e
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+run_via_rtld_prefix=$1; shift
+test_wrapper=$1; shift
+test_wrapper_env=$1; shift
+run_program_prefix="${test_wrapper} ${run_via_rtld_prefix}"
logfile=$common_objpfx/posix/globtest.out
#CMP=cmp
@@ -758,8 +761,9 @@ cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
`dir6/file1[ab]'
`nondir\/'
EOF
+${test_wrapper_env} \
HOME="$testdir" \
-${run_program_prefix} \
+${run_via_rtld_prefix} \
${common_objpfx}posix/globtest -ct "$testdir" \
'~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
'~\/dir1/file1_2' |