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
12 testout
=$TMPDIR/wordexp-test-result
15 export IFS
=$
(echo -e " \t\n")
17 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
18 ${common_objpfx}posix
/wordexp-test
'$*' > ${testout}1
19 cat <<"EOF" | cmp - ${testout}1 || failed=1
24 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
25 ${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
26 cat <<"EOF" |
cmp - ${testout}2 || failed
=1
29 we_wordv
[1] = "unquoted"
32 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
33 ${common_objpfx}posix
/wordexp-test
'$@' unquoted
> ${testout}3
34 cat <<"EOF" | cmp - ${testout}3 || failed=1
37 we_wordv[1] = "unquoted"
40 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
41 ${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
42 cat <<"EOF" |
cmp - ${testout}4 || failed
=1
44 we_wordv
[0] = ""$
* quoted
" param quoted"
47 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
48 ${common_objpfx}posix
/wordexp-test
'"$@ quoted"' param
> ${testout}5
49 cat <<"EOF" | cmp - ${testout}5 || failed=1
51 we_wordv[0] = ""$@ quoted""
52 we_wordv[1] = "param quoted"
54 # Why? Because bash does it that way..
56 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
57 ${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
58 cat <<"EOF" |
cmp - ${testout}6 || failed
=1
63 ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
64 ${common_objpfx}posix/wordexp-test '$2 ${3}' 2nd 3rd > ${testout}6
65 cat <<"EOF" | cmp - ${testout}6 || failed=1