diff options
Diffstat (limited to 'posix/globtest.sh')
-rwxr-xr-x | posix/globtest.sh | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/posix/globtest.sh b/posix/globtest.sh index 24a1641bdb..6f3eaddd8f 100755 --- a/posix/globtest.sh +++ b/posix/globtest.sh @@ -20,10 +20,9 @@ set -e common_objpfx=$1; shift -run_via_rtld_prefix=$1; shift -test_wrapper=$1; shift +test_via_rtld_prefix=$1; shift +test_program_prefix=$1; shift test_wrapper_env=$1; shift -run_program_prefix="${test_wrapper} ${run_via_rtld_prefix}" logfile=$common_objpfx/posix/globtest.out #CMP=cmp @@ -78,7 +77,7 @@ rm -f $logfile # Normal test failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -105,7 +104,7 @@ fi # Don't let glob sort it failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -s "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -132,7 +131,7 @@ fi # Mark directories failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -m "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -159,7 +158,7 @@ fi # Find files starting with . failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -p "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -189,7 +188,7 @@ fi # Test braces failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -202,7 +201,7 @@ if test $failed -ne 0; then fi failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -216,7 +215,7 @@ if test $failed -ne 0; then fi failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" "{" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -229,7 +228,7 @@ fi # Test NOCHECK failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -c "$testdir" "abc" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -242,7 +241,7 @@ fi # Test NOMAGIC without magic characters failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -g "$testdir" "abc" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -255,7 +254,7 @@ fi # Test NOMAGIC with magic characters failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -g "$testdir" "abc*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -268,7 +267,7 @@ fi # Test NOMAGIC for subdirs failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -281,7 +280,7 @@ fi # Test subdirs correctly failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -297,7 +296,7 @@ fi # Test subdirs for invalid names failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/1" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -310,7 +309,7 @@ fi # Test subdirs with wildcard failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*1_1" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -324,7 +323,7 @@ fi # Test subdirs with ? failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*?_?" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -339,7 +338,7 @@ if test $failed -ne 0; then fi failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/file1_1" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -352,7 +351,7 @@ if test $failed -ne 0; then fi failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*-/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -364,7 +363,7 @@ if test $failed -ne 0; then fi failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*-" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -377,7 +376,7 @@ fi # Test subdirs with ? failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*?_?" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -393,7 +392,7 @@ fi # Test subdirs with [ .. ] failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -409,7 +408,7 @@ fi # Test ']' inside bracket expression failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -423,7 +422,7 @@ fi # Test tilde expansion failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -q -t "$testdir" "~" | sort >$testout echo ~ | $CMP - $testout >> $logfile || failed=1 @@ -438,7 +437,7 @@ fi # Test tilde expansion with trailing slash failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -q -t "$testdir" "~/" | sort > $testout # Some shell incorrectly(?) convert ~/ into // if ~ expands to /. @@ -458,7 +457,7 @@ fi # Test tilde expansion with username failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER | sort > $testout eval echo ~$USER | $CMP - $testout >> $logfile || failed=1 @@ -473,7 +472,7 @@ fi # Tilde expansion shouldn't match a file failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -T "$testdir" "~file4" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -486,7 +485,7 @@ fi # Matching \** should only find *file6 failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "\**" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -500,7 +499,7 @@ fi # ... unless NOESCAPE is used, in which case it should entries with a # leading \. failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -e "$testdir" "\**" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -515,7 +514,7 @@ fi # Matching \*file6 should find *file6 failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "\*file6" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -528,7 +527,7 @@ fi # GLOB_BRACE alone failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -541,7 +540,7 @@ fi # GLOB_BRACE and GLOB_NOESCAPE failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -554,7 +553,7 @@ fi # Escaped comma failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -567,7 +566,7 @@ fi # Escaped closing brace failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -580,7 +579,7 @@ fi # Try a recursive failed search failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -e "$testdir" "a*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -593,7 +592,7 @@ fi # ... with GLOB_ERR failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -E "$testdir" "a*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -606,7 +605,7 @@ fi # Try a recursive search in unreadable directory failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "noread/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -618,7 +617,7 @@ if test $failed -ne 0; then fi failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "noread*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -636,14 +635,14 @@ if test -z "$user"; then fi if test "$user" != root; then # ... with GLOB_ERR - ${run_program_prefix} \ + ${test_program_prefix} \ ${common_objpfx}posix/globtest -E "$testdir" "noread/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 GLOB_ABORTED EOF - ${run_program_prefix} \ + ${test_program_prefix} \ ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -657,7 +656,7 @@ fi # not run as root # Try multiple patterns (GLOB_APPEND) failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "file1" "*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -674,7 +673,7 @@ fi # Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS) failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -692,7 +691,7 @@ fi # Test NOCHECK with non-existing file in subdir. failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -705,7 +704,7 @@ fi # Test [[:punct:]] not matching leading period. failed=0 -${run_program_prefix} \ +${test_program_prefix} \ ${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -734,10 +733,10 @@ mkdir $testdir/dir6 echo 6 > $testdir/dir6/'file1[a' echo 7 > $testdir/dir6/'file1[ab]' failed=0 -v=`${run_program_prefix} \ +v=`${test_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'` test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1 -${run_program_prefix} \ +${test_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]' \ @@ -763,7 +762,7 @@ cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 EOF ${test_wrapper_env} \ HOME="$testdir" \ -${run_via_rtld_prefix} \ +${test_via_rtld_prefix} \ ${common_objpfx}posix/globtest -ct "$testdir" \ '~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \ '~\/dir1/file1_2' | @@ -778,15 +777,15 @@ EOF if eval test -d ~"$USER"/; then user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'` if test -n "$user"; then - ${run_program_prefix} \ + ${test_program_prefix} \ ${common_objpfx}posix/globtest -ctq "$testdir" "$user/" | sort > $testout eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1 - ${run_program_prefix} \ + ${test_program_prefix} \ ${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" | sort > $testout eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1 - ${run_program_prefix} \ + ${test_program_prefix} \ ${common_objpfx}posix/globtest -ctq "$testdir" "$user" | sort > $testout eval echo ~$USER | $CMP - $testout >> $logfile || failed=1 |