summaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-01-11 07:14:18 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-01-11 07:14:18 -0800
commit740b3dbee8ef034019b240dc4838b39dfa0c01e2 (patch)
tree6b4caa77b597058c873bd5df2e0f7a859327c90a /posix
parentc6fe55cf6089fc5cf1cea15fc7e1c9a8b90d9fda (diff)
Add --enable-hardcoded-path-in-tests configure option
Diffstat (limited to 'posix')
-rw-r--r--posix/Makefile12
-rwxr-xr-xposix/globtest.sh101
-rwxr-xr-xposix/wordexp-tst.sh22
3 files changed, 67 insertions, 68 deletions
diff --git a/posix/Makefile b/posix/Makefile
index fda6e13bda..57672d8837 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -119,10 +119,10 @@ 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-via-rtld-prefix)' \
- '$(test-wrapper)' '$(test-wrapper-env)'
+ $(SHELL) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
+ '$(test-program-prefix)' '$(test-wrapper-env)'
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
- $(SHELL) $< $(common-objpfx) '$(run-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
endif
endif
@@ -173,9 +173,9 @@ CFLAGS-execlp.os = -fomit-frame-pointer
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
-tst-exec-ARGS = -- $(host-built-program-cmd)
+tst-exec-ARGS = -- $(host-test-program-cmd)
tst-exec-static-ARGS = $(tst-exec-ARGS)
-tst-spawn-ARGS = -- $(host-built-program-cmd)
+tst-spawn-ARGS = -- $(host-test-program-cmd)
tst-spawn-static-ARGS = $(tst-spawn-ARGS)
tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
tst-chmod-ARGS = $(objdir)
@@ -268,7 +268,7 @@ $(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
# time to process.
$(objpfx)tst-rxspencer-mem: $(objpfx)tst-rxspencer.out
MALLOC_TRACE=$(objpfx)tst-rxspencer.mtrace $(tst-rxspencer-ENV) \
- $(run-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \
+ $(test-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \
> /dev/null
$(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer.mtrace > $@
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
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index 93b507787f..5dff727e34 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -24,7 +24,7 @@ set -e
# The others are just there to be parameters.
common_objpfx=$1; shift
-run_program_prefix=$1; shift
+test_program_prefix=$1; shift
logfile=${common_objpfx}posix/wordexp-tst.out
testout=${common_objpfx}posix/wordexp-test-result
@@ -38,7 +38,7 @@ IFS=" \
export IFS
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
wordexp returned 0
@@ -50,7 +50,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
wordexp returned 0
@@ -63,7 +63,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
wordexp returned 0
@@ -76,7 +76,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
wordexp returned 0
@@ -88,7 +88,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
wordexp returned 0
@@ -102,7 +102,7 @@ fi
# Why? Because bash does it that way..
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
wordexp returned 0
@@ -114,7 +114,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_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
@@ -129,7 +129,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_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
@@ -141,7 +141,7 @@ if test $failed -ne 0; then
fi
failed=0
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
wordexp returned 0
@@ -154,7 +154,7 @@ if test $failed -ne 0; then
status=1
fi
-${run_program_prefix} \
+${test_program_prefix} \
${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
cat <<"EOF" | cmp - ${testout}10 || failed=1
wordexp returned 0