aboutsummaryrefslogtreecommitdiff
path: root/posix/wordexp-tst.sh
diff options
context:
space:
mode:
Diffstat (limited to 'posix/wordexp-tst.sh')
-rwxr-xr-xposix/wordexp-tst.sh69
1 files changed, 58 insertions, 11 deletions
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index 43dc0a5ac9..8fe697e07d 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -7,11 +7,13 @@
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+logfile=$common_objpfx/posix/wordexp-tst.out
: ${TMPDIR=${common_objpfx}posix}
testout=$TMPDIR/wordexp-test-result
-failed=0
+result=0
+rm -f $logfile
# This is written in this funny way so that there is no trailing whitespace.
# The first line contains a space followed by a tab.
IFS=" \
@@ -19,77 +21,122 @@ IFS=" \
"
export IFS
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
-cat <<"EOF" | cmp - ${testout}1 || failed=1
+cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "$*"
EOF
+if test $failed -ne 0; then
+ echo '$* test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
-cat <<"EOF" | cmp - ${testout}2 || failed=1
+cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "${*}"
we_wordv[1] = "unquoted"
EOF
+if test $failed -ne 0; then
+ echo '${*} test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
-cat <<"EOF" | cmp - ${testout}3 || failed=1
+cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "$@"
we_wordv[1] = "unquoted"
EOF
+if test $failed -ne 0; then
+ echo '$@ test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
-cat <<"EOF" | cmp - ${testout}4 || failed=1
+cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = ""$* quoted" param quoted"
EOF
+if test $failed -ne 0; then
+ echo '$* quoted test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
-cat <<"EOF" | cmp - ${testout}5 || failed=1
+cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = ""$@ quoted""
we_wordv[1] = "param quoted"
EOF
+if test $failed -ne 0; then
+ echo '$@ quoted test failed'
+ status=1
+fi
# Why? Because bash does it that way..
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
-cat <<"EOF" | cmp - ${testout}6 || failed=1
+cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "5"
EOF
+if test $failed -ne 0; then
+ echo '$# test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
-cat <<"EOF" | cmp - ${testout}7 || failed=1
+cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "2nd"
we_wordv[1] = "3rd"
we_wordv[2] = "4"
we_wordv[3] = "th"
EOF
+if test $failed -ne 0; then
+ echo '$2 ${3} $4 test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
-cat <<"EOF" | cmp - ${testout}8 || failed=1
+cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "11"
EOF
+if test $failed -ne 0; then
+ echo '${11} test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
-cat <<"EOF" | cmp - ${testout}9 || failed=1
+cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "a "a $@ b""
we_wordv[1] = "c"
we_wordv[2] = "d b"
EOF
+if test $failed -ne 0; then
+ echo '"a $@ b" test failed'
+ status=1
+fi
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
@@ -105,4 +152,4 @@ we_wordv[6] = "3"
we_wordv[7] = "4*"
EOF
-exit $failed
+exit $result