]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Support cross-testing.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 24 Oct 2012 21:59:01 +0000 (21:59 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 24 Oct 2012 21:59:01 +0000 (21:59 +0000)
13 files changed:
ChangeLog
Makeconfig
Rules
elf/Makefile
elf/tst-pathopt.sh
elf/tst-rtld-load-self.sh
iconvdata/Makefile
iconvdata/run-iconv-test.sh
nptl/ChangeLog
nptl/Makefile
nptl/tst-tls6.sh
posix/Makefile
posix/globtest.sh

index 28f485a06a73d61b61fff31781bb8bf4dcd4fd3f..a62630facfc3813de63820d2b498508ec2a26f04 100644 (file)
--- 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.
index 1b1604af566102b32a008cc6c9ef918a9aad4363..2b9e735c4df01c14024e5f3ae948bf537e34d2b2 100644 (file)
@@ -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 db5bad0c859a0aeb70262aef2bad87d002d6c6b0..35e6ce0bf12f265ed8513da7ff0d2d0963b9a076 100644 (file)
--- 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)%
index 4f092ab2afb5273aa322cf6c01ab70cde8831382..f539f13756e6247f5dd17ad2516dc7839d374f61 100644 (file)
@@ -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= \
index 048c612645e451be5481289e705a9bafd591e398..2f8bfc689a1449f0cac3b395c27cd5464ed98dd2 100755 (executable)
@@ -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 \
index f4c5dea23af9a45b2cb80ee125175a70f1b21006..18723a9bad7fe17c978576a6d673bc661234cb1d 100755 (executable)
 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
 
index 89f0dcd9c30c4c5f5f7829d2508b00c604220b72..2840cff9ce5dcccd263ccb0f9951185ebcc05bdb 100644 (file)
@@ -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)) \
index cb9f5dffb219e7fc0b5b011af99c9c06cb3e8ec0..ec8f024cc9e9c6350397d4c33f51a9fc15f6e5b8 100755 (executable)
@@ -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
index d0b5d6c7b8b1cf74b9ad8b4f61f435a8d9c1949a..040b64c4edc59ceb597dc07c4b682427c6f46356 100644 (file)
@@ -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.
index 7387a640b993103c8ce3ebd80f9624ad304b0317..f84646ee0459028257cfebffccb10c00f246a522 100644 (file)
@@ -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)
index 2622e3385918fbadb9eac0064f230771b2258753..6ef1232822ebc71e895898feec815109724859c1 100755 (executable)
@@ -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
index add2ca5be6f01683477e6d6ae2b00fad680c53a7..853152ea99f8bd2d2eb4c79fa165dd06175302ac 100644 (file)
@@ -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
index ea947b855a8f775153fc908f2949040401664fd1..121be85961ea6eb4f9d3c1a7bfa3ff903d2148c5 100755 (executable)
 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' |