1998-03-14 01:02:23 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Some of these tests may look a little weird.
|
|
|
|
# The first parameter to wordexp-test is what it gives to wordexp.
|
|
|
|
# The others are just there to be parameters.
|
|
|
|
|
|
|
|
common_objpfx=$1; shift
|
|
|
|
elf_objpfx=$1; shift
|
|
|
|
rtld_installed_name=$1; shift
|
2000-10-21 08:02:39 +08:00
|
|
|
logfile=${common_objpfx}posix/wordexp-tst.out
|
|
|
|
testout=${common_objpfx}posix/wordexp-test-result
|
1998-03-14 01:02:23 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
result=0
|
|
|
|
rm -f $logfile
|
1998-03-18 22:42:25 +08:00
|
|
|
# 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=" \
|
|
|
|
|
|
|
|
"
|
|
|
|
export IFS
|
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-14 01:02:23 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
|
1998-03-14 01:02:23 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "$*"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '$* test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-14 01:02:23 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-14 01:02:23 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
|
1998-03-14 01:02:23 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "${*}"
|
|
|
|
we_wordv[1] = "unquoted"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '${*} test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-14 01:02:23 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-14 01:02:23 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
|
1998-03-14 01:02:23 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "$@"
|
|
|
|
we_wordv[1] = "unquoted"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '$@ test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-14 01:02:23 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-14 01:02:23 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
|
1998-03-14 01:02:23 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = ""$* quoted" param quoted"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '$* quoted test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-14 01:02:23 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-14 01:02:23 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
|
1998-03-14 01:02:23 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = ""$@ quoted""
|
|
|
|
we_wordv[1] = "param quoted"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '$@ quoted test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-14 01:02:23 +08:00
|
|
|
# Why? Because bash does it that way..
|
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-14 01:02:23 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
|
1998-03-14 01:02:23 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "5"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '$# test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-14 01:02:23 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-14 01:02:23 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
1998-03-14 17:27:24 +08:00
|
|
|
${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1
|
1998-03-14 01:02:23 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "2nd"
|
|
|
|
we_wordv[1] = "3rd"
|
1998-03-14 17:27:24 +08:00
|
|
|
we_wordv[2] = "4"
|
|
|
|
we_wordv[3] = "th"
|
1998-03-14 01:02:23 +08:00
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '$2 ${3} $4 test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-14 01:02:23 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-18 22:42:25 +08:00
|
|
|
${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
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1
|
1998-03-18 22:42:25 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "11"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '${11} test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-18 22:42:25 +08:00
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
failed=0
|
1998-03-18 22:42:25 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
|
2000-07-23 09:23:29 +08:00
|
|
|
cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
|
1998-03-18 22:42:25 +08:00
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "a "a $@ b""
|
|
|
|
we_wordv[1] = "c"
|
|
|
|
we_wordv[2] = "d b"
|
|
|
|
EOF
|
2000-07-23 09:23:29 +08:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo '"a $@ b" test failed'
|
|
|
|
status=1
|
|
|
|
fi
|
1998-03-18 22:42:25 +08:00
|
|
|
|
1998-03-25 04:51:53 +08:00
|
|
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
|
|
|
${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
|
|
|
|
cat <<"EOF" | cmp - ${testout}10 || failed=1
|
|
|
|
wordexp returned 0
|
|
|
|
we_wordv[0] = "4"
|
|
|
|
we_wordv[1] = "3"
|
|
|
|
we_wordv[2] = "*${#@}"
|
|
|
|
we_wordv[3] = "${#2}"
|
|
|
|
we_wordv[4] = "*$**"
|
|
|
|
we_wordv[5] = "two"
|
|
|
|
we_wordv[6] = "3"
|
|
|
|
we_wordv[7] = "4*"
|
|
|
|
EOF
|
|
|
|
|
2000-07-23 09:23:29 +08:00
|
|
|
exit $result
|