This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Use $(run-program-prefix) in more shell script tests


This is a second piece of changes in support of cross-testing, split
out / reworked to reduce the size of the main cross-testing patch.

Various tests are run via shell scripts which run ld.so --library-path
not via $(run-program-prefix) passed to the shell script, but via
other arguments passed to the script from which a suitable ld.so
command is constructed.  This patch changes such scripts to use
$(run-program-prefix), passed from the makefiles.  (Various other
shell script used in testing already do this before this patch.)

This is less conservative than the original cross-testing patch - the
original patch passed $(cross-test-wrapper) down in these cases, so
leaving the exact command run for native testing unchanged, but this
patch will change the details of exactly what directories are in the
--library-path option.  However, I think the changes are appropriate
here - generally, it seems good to have consistency in how test
binaries are run, and this improves consistency - and this patch
reduces the number of places that need to be explicitly aware of
cross-testing.

(I deferred doing anything like this with posix/globtest.sh because of
one place where the cross-testing changes do something special with a
test being run with a special value of HOME on the basis that HOME may
be a problematic environment variable to propagate from the build
system to the host.  This patch deals with those tests for which I
think the changes are straightforward and unproblematic.)

Tested x86_64.

2012-10-19  Joseph Myers  <joseph@codesourcery.com>

	* grp/Makefile ($(objpfx)tst_fgetgrent.out): Pass
	$(run-program-prefix) to tst_fgetgrent.sh, not $(elf-objpfx) and
	$(rtld-installed-name).
	* grp/tst_fgetgrent.sh (elf_objpfx): Remove variable.
	(rtld_installed_name): Likewise.
	(library_path): Likewise.
	(run_program_prefix): New variable.  Use it to run tst_fgetgrent.
	* iconvdata/Makefile ($(objpfx)tst-tables.out): Pass
	$(run-program-prefix) to tst-tables.sh.
	* iconvdata/tst-table.sh (run_program_prefix): New variable.  Use
	it to run tst-table-from and tst-table-to.
	* iconvdata/tst-tables.sh (run_program_prefix): New variable.
	Pass it to tst-table.sh.
	* intl/Makefile ($(objpfx)tst-gettext.out): Pass
	$(run-program-prefix) to tst-gettext.sh.
	($(objpfx)tst-translit.out): Pass $(run-program-prefix) to
	tst-translit.sh.
	($(objpfx)tst-gettext2.out): Pass $(run-program-prefix) to
	tst-gettext2.sh.
	* intl/tst-gettext.sh (run_program_prefix): New variable.  Use it
	to run tst-gettext.
	* intl/tst-gettext2.sh (run_program_prefix): New variable.  Use it
	to run tst-gettext2.
	* intl/tst-translit.sh (run_program_prefix): New variable.  Use it
	to run tst-translit.
	* malloc/Makefile ($(objpfx)tst-mtrace.out): Pass
	$(run-program-prefix) to tst-mtrace.sh.
	* malloc/tst-mtrace.sh (run_program_prefix): New variable.  Use it
	to run tst-mtrace.
	* posix/Makefile ($(objpfx)wordexp-tst.out): Pass
	$(run-program-prefix) to wordexp-tst.sh, not $(elf-objpfx) and
	$(rtld-installed-name).
	* posix/wordexp-tst.sh (elf_objpfx): Remove variable.
	(rtld_installed_name): Likewise.
	(run_program_prefix): New variable.  Use it to run wordexp-test.

diff --git a/grp/Makefile b/grp/Makefile
index 8cb99c1..1988cbf 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -55,8 +55,7 @@ ifeq (no,$(cross-compiling))
 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)
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
 
 endif
 endif
diff --git a/grp/tst_fgetgrent.sh b/grp/tst_fgetgrent.sh
index 7e69815..0f21ee8 100644
--- a/grp/tst_fgetgrent.sh
+++ b/grp/tst_fgetgrent.sh
@@ -20,24 +20,22 @@
 set -e
 
 common_objpfx=$1; shift
-elf_objpfx=$1; shift
-rtld_installed_name=$1; shift
+run_program_prefix=$1; shift
 
 testout=${common_objpfx}/grp/tst_fgetgrent.out
-library_path=${common_objpfx}
 
 result=0
 
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
 ${common_objpfx}grp/tst_fgetgrent 0 > ${testout} || result=1
 
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
 ${common_objpfx}grp/tst_fgetgrent 1 >> ${testout} || result=1
 
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
 ${common_objpfx}grp/tst_fgetgrent 2 >> ${testout} || result=1
 
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_program_prefix} \
 ${common_objpfx}grp/tst_fgetgrent 3 >> ${testout} || result=1
 
 exit $result
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 2ddcae5..cf6cf70 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -304,7 +304,8 @@ $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
 $(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/ \
+		'$(run-program-prefix)' > $@
 
 do-tests-clean common-mostlyclean: tst-tables-clean
 
diff --git a/iconvdata/tst-table.sh b/iconvdata/tst-table.sh
index 05f7c6f..14ab196 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
+run_program_prefix=$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 \
+${run_program_prefix} \
 ${objpfx}tst-table-from ${charset} \
   > ${objpfx}tst-${charset}.table
 
 # iconv in the other direction.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
 ${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..f65b72d 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
+run_program_prefix=$3
 
 status=0
 
@@ -261,7 +262,8 @@ 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
+  if ${SHELL} tst-table.sh ${common_objpfx} ${objpfx} "${run_program_prefix}" \
+      ${charset} ${charmap}; 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..5bf6606 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -74,12 +74,14 @@ $(codeset_mo): tstcodeset.po
 $(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
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+	  $(common-objpfx)intl/ $(objpfx)tst-gettext.mtrace
 $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
-	$(SHELL) $< $(common-objpfx) $(common-objpfx)intl/
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+	  $(common-objpfx)intl/
 $(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
-	$(SHELL) $< $(common-objpfx) $(common-objpfx)intl/
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
+	  $(common-objpfx)intl/
 $(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
diff --git a/intl/tst-gettext.sh b/intl/tst-gettext.sh
index a3ac377..a3bb0a6 100755
--- a/intl/tst-gettext.sh
+++ b/intl/tst-gettext.sh
@@ -20,8 +20,9 @@
 set -e
 
 common_objpfx=$1
-objpfx=$2
-malloc_trace=$3
+run_program_prefix=$2
+objpfx=$3
+malloc_trace=$4
 
 LC_ALL=C
 export LC_ALL
@@ -53,7 +54,7 @@ export LOCPATH
 
 # Now run the test.
 MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
 ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
 
 exit $?
diff --git a/intl/tst-gettext2.sh b/intl/tst-gettext2.sh
index 2d9c52f..833b979 100644
--- a/intl/tst-gettext2.sh
+++ b/intl/tst-gettext2.sh
@@ -20,7 +20,8 @@
 set -e
 
 common_objpfx=$1
-objpfx=$2
+run_program_prefix=$2
+objpfx=$3
 
 LC_ALL=C
 export LC_ALL
@@ -66,7 +67,7 @@ LOCPATH=${objpfx}domaindir
 export LOCPATH
 
 # Now run the test.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
 ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
 cmp ${objpfx}tst-gettext2.out - <<EOF
 String1 - Lang1: 1st string
diff --git a/intl/tst-translit.sh b/intl/tst-translit.sh
index 93159c7..27cd1bf 100755
--- a/intl/tst-translit.sh
+++ b/intl/tst-translit.sh
@@ -20,7 +20,8 @@
 set -e
 
 common_objpfx=$1
-objpfx=$2
+run_program_prefix=$2
+objpfx=$3
 
 LC_ALL=C
 export LC_ALL
@@ -36,7 +37,7 @@ export GCONV_PATH
 LOCPATH=${common_objpfx}localedata
 export LOCPATH
 
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
 ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
 
 exit $?
diff --git a/malloc/Makefile b/malloc/Makefile
index eb909fd..9dd0336 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -109,7 +109,7 @@ 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)
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
 endif
 endif
 endif
diff --git a/malloc/tst-mtrace.sh b/malloc/tst-mtrace.sh
index 14b0ad4..d81e550 100755
--- a/malloc/tst-mtrace.sh
+++ b/malloc/tst-mtrace.sh
@@ -20,13 +20,14 @@
 set -e
 
 common_objpfx=$1; shift
+run_program_prefix=$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 \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
   ${common_objpfx}malloc/tst-mtrace || status=1
 
 if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
diff --git a/posix/Makefile b/posix/Makefile
index 182c120..9cc393a 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -120,8 +120,7 @@ $(objpfx)globtest.out: globtest.sh $(objpfx)globtest
 	$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
 		 $(rtld-installed-name)
 $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
-	$(SHELL) $< $(common-objpfx) $(elf-objpfx) \
-		 $(rtld-installed-name)
+	$(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
 endif
 endif
 
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index fec5292..f669195 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -24,8 +24,7 @@ set -e
 # The others are just there to be parameters.
 
 common_objpfx=$1; shift
-elf_objpfx=$1; shift
-rtld_installed_name=$1; shift
+run_program_prefix=$1; shift
 logfile=${common_objpfx}posix/wordexp-tst.out
 testout=${common_objpfx}posix/wordexp-test-result
 
@@ -39,7 +38,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 +50,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 +63,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 +76,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 +88,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 +102,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 +114,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 +129,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 +141,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 +154,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

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]