3 # Some of these tests may look a little weird.
4 # The first parameter to wordexp-test is what it gives to wordexp.
5 # The others are just there to be parameters.
7 common_objpfx=$1; shift
9 rtld_installed_name=$1; shift
10 logfile=${common_objpfx}posix/wordexp-tst.out
11 testout=${common_objpfx}posix/wordexp-test-result
15 # This is written in this funny way so that there is no trailing whitespace.
16 # The first line contains a space followed by a tab.
23 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
24 ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
25 cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
29 if test $failed -ne 0; then
35 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
36 ${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
37 cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
40 we_wordv[1] = "unquoted"
42 if test $failed -ne 0; then
43 echo '${*} test failed'
48 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
49 ${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
50 cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
53 we_wordv[1] = "unquoted"
55 if test $failed -ne 0; then
61 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
62 ${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
63 cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
65 we_wordv[0] = ""$* quoted" param quoted"
67 if test $failed -ne 0; then
68 echo '$* quoted test failed'
73 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
74 ${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
75 cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
77 we_wordv[0] = ""$@ quoted""
78 we_wordv[1] = "param quoted"
80 if test $failed -ne 0; then
81 echo '$@ quoted test failed'
84 # Why? Because bash does it that way..
87 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
88 ${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
89 cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
93 if test $failed -ne 0; then
99 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
100 ${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
101 cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1
108 if test $failed -ne 0; then
109 echo '$2 ${3} $4 test failed'
114 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
115 ${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
116 cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1
120 if test $failed -ne 0; then
121 echo '${11} test failed'
126 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
127 ${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
128 cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
130 we_wordv[0] = "a "a $@ b""
134 if test $failed -ne 0; then
135 echo '"a $@ b" test failed'
139 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
140 ${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
141 cat <<"EOF" | cmp - ${testout}10 || failed=1
145 we_wordv[2] = "*${#@}"
146 we_wordv[3] = "${#2}"