Update.
[glibc.git] / posix / wordexp-tst.sh
blobe341e6435dfab6bc722ca880ff5a2bb8f6efc9d0
1 #!/bin/sh
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
8 elf_objpfx=$1; shift
9 rtld_installed_name=$1; shift
11 : ${TMPDIR=/tmp}
12 testout=$TMPDIR/wordexp-test-result
14 failed=0
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
20 wordexp returned 0
21 we_wordv[0] = "$*"
22 EOF
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
27 wordexp returned 0
28 we_wordv[0] = "${*}"
29 we_wordv[1] = "unquoted"
30 EOF
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
35 wordexp returned 0
36 we_wordv[0] = "$@"
37 we_wordv[1] = "unquoted"
38 EOF
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
43 wordexp returned 0
44 we_wordv[0] = ""$* quoted" param quoted"
45 EOF
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
50 wordexp returned 0
51 we_wordv[0] = ""$@ quoted""
52 we_wordv[1] = "param quoted"
53 EOF
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
59 wordexp returned 0
60 we_wordv[0] = "5"
61 EOF
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
66 wordexp returned 0
67 we_wordv[0] = "2nd"
68 we_wordv[1] = "3rd"
69 EOF
71 exit $failed