]> sourceware.org Git - glibc.git/blame - posix/wordexp-tst.sh
Update.
[glibc.git] / posix / wordexp-tst.sh
CommitLineData
14c44e2e
UD
1#!/bin/sh
2
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.
6
7common_objpfx=$1; shift
8elf_objpfx=$1; shift
9rtld_installed_name=$1; shift
10
67600288 11: ${TMPDIR=${common_objpfx}posix}
14c44e2e
UD
12testout=$TMPDIR/wordexp-test-result
13
14failed=0
31161268
UD
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.
17IFS=" \
18
19"
20export IFS
21
14c44e2e
UD
22${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
23${common_objpfx}posix/wordexp-test '$*' > ${testout}1
24cat <<"EOF" | cmp - ${testout}1 || failed=1
25wordexp returned 0
26we_wordv[0] = "$*"
27EOF
28
29${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
30${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
31cat <<"EOF" | cmp - ${testout}2 || failed=1
32wordexp returned 0
33we_wordv[0] = "${*}"
34we_wordv[1] = "unquoted"
35EOF
36
37${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
38${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
39cat <<"EOF" | cmp - ${testout}3 || failed=1
40wordexp returned 0
41we_wordv[0] = "$@"
42we_wordv[1] = "unquoted"
43EOF
44
45${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
46${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
47cat <<"EOF" | cmp - ${testout}4 || failed=1
48wordexp returned 0
49we_wordv[0] = ""$* quoted" param quoted"
50EOF
51
52${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
53${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
54cat <<"EOF" | cmp - ${testout}5 || failed=1
55wordexp returned 0
56we_wordv[0] = ""$@ quoted""
57we_wordv[1] = "param quoted"
58EOF
59# Why? Because bash does it that way..
60
61${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
62${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
63cat <<"EOF" | cmp - ${testout}6 || failed=1
64wordexp returned 0
65we_wordv[0] = "5"
66EOF
67
68${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
76fbcfdd
UD
69${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
70cat <<"EOF" | cmp - ${testout}7 || failed=1
14c44e2e
UD
71wordexp returned 0
72we_wordv[0] = "2nd"
73we_wordv[1] = "3rd"
76fbcfdd
UD
74we_wordv[2] = "4"
75we_wordv[3] = "th"
14c44e2e
UD
76EOF
77
31161268
UD
78${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
79${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
80cat <<"EOF" | cmp - ${testout}8 || failed=1
81wordexp returned 0
82we_wordv[0] = "11"
83EOF
84
85${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
86${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
87cat <<"EOF" | cmp - ${testout}9 || failed=1
88wordexp returned 0
89we_wordv[0] = "a "a $@ b""
90we_wordv[1] = "c"
91we_wordv[2] = "d b"
92EOF
93
e9fc7bbb
UD
94${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
95${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
96cat <<"EOF" | cmp - ${testout}10 || failed=1
97wordexp returned 0
98we_wordv[0] = "4"
99we_wordv[1] = "3"
100we_wordv[2] = "*${#@}"
101we_wordv[3] = "${#2}"
102we_wordv[4] = "*$**"
103we_wordv[5] = "two"
104we_wordv[6] = "3"
105we_wordv[7] = "4*"
106EOF
107
14c44e2e 108exit $failed
This page took 0.072319 seconds and 5 git commands to generate.