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-via-rtld-prefix) in posix/globtest.sh


This patch, relative to a tree with
<http://sourceware.org/ml/libc-alpha/2012-10/msg00510.html> (pending
review) applied, stops posix/globtest.sh from hardcoding how to run
the dynamic linker to run newly built tests.  Instead,
run-via-rtld-prefix is passed down from the makefile.

The idea is to pass down cross-test-wrapper as well for the
cross-testing support - this patch has the great bulk of the
mechanical changes to globtest.sh, while just a few local changes will
be needed for the final cross-testing support.  This approach, rather
than simply passing down run-program-prefix, is taken to avoid
requiring the cross-testing wrapper to pass a modified value of HOME
from the build system to glibc's host system (it seems safer for most
tests to have the value of HOME from the system on which the tests
run, not that from the build system if different - though for this
particular test, further work may still be needed if it is to work in
environments where the home directory or username are different on the
two systems).  Instead, I expect the actual cross-testing patch to
follow a similar approach to the original one here,
"${cross_test_wrapper} env HOME=$testdir ${run_via_rtld_prefix} ...".

Tested x86_64.

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

	* posix/Makefile ($(objpfx)globtest.out): Pass
	$(run-via-rtld-prefix) to globtest.sh, not $(elf-objpfx) and
	$(rtld-installed-name).
	* posix/globtest.sh (elf_objpfx): Remove variable.
	(rtld_installed_name): Likewise.
	(library_path): Likewise.
	(run_via_rtld_prefix): New variable.  Use for running globtest
	binary.
	(run_program_prefix): Likewise.

diff --git a/posix/Makefile b/posix/Makefile
index 6e3d0bb..570e110 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -117,8 +117,7 @@ ifeq (no,$(cross-compiling))
 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)
+	$(SHELL) $< $(common-objpfx) '$(run-via-rtld-prefix)'
 $(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 286b1b4..c8a13e5 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -20,8 +20,8 @@
 set -e
 
 common_objpfx=$1; shift
-elf_objpfx=$1; shift
-rtld_installed_name=$1; shift
+run_via_rtld_prefix=$1; shift
+run_program_prefix=$run_via_rtld_prefix
 logfile=$common_objpfx/posix/globtest.out
 
 #CMP=cmp
@@ -36,9 +36,6 @@ case "$common_objpfx" in
     ;;
 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
-
 # Since we use `sort' we must make sure to use the same locale everywhere.
 LC_ALL=C
 export LC_ALL
@@ -78,7 +75,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 +102,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 +129,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 +156,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 +186,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 +199,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 +213,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 +226,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 +239,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 +252,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 +265,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 +278,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 +294,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 +307,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 +321,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 +336,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 +349,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 +361,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 +374,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 +390,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 +406,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 +420,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 +435,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 +455,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 +470,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 +483,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 +497,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 +512,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 +525,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 +538,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 +551,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 +564,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 +577,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 +590,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 +603,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 +615,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 +633,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 +654,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 +671,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 +689,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 +702,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 +731,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]' \
@@ -762,7 +759,7 @@ cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
 `nondir\/'
 EOF
 HOME="$testdir" \
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${run_via_rtld_prefix} \
 ${common_objpfx}posix/globtest -ct "$testdir" \
 '~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
 '~\/dir1/file1_2' |
@@ -777,15 +774,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

-- 
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]