*** empty log message ***
[coreutils.git] / tests / ls-2 / ls-tests
blobe43ee167ac3a8856463a23a96da1beea3ed4fd67
1 #! /bin/sh
2 # This script was generated automatically by ./../mk-script.
3 case $# in
4 0) xx='../../src/ls';;
5 *) xx="$1";;
6 esac
7 test "$VERBOSE" && echo=echo || echo=:
8 $echo testing program: $xx
9 errors=0
10 test "$srcdir" || srcdir=.
11 test "$VERBOSE" && $xx --version 2> /dev/null
13 # Make sure we get English translations.
14 LANGUAGE=C
15 export LANGUAGE
16 LC_ALL=C
17 export LC_ALL
18 LANG=C
19 export LANG
21 filename_args="$srcdir/quotable\a"
22 new_filename_args=
23 for arg in $filename_args; do
24 if test -r $arg; then
25 basename_arg=`echo $arg|sed 's,.*/,,'`
26 test -f $basename_arg || cp -a $arg .
27 arg=$basename_arg
29 new_filename_args="$new_filename_args $arg"
30 done
31 filename_args=$new_filename_args
33 $xx $filename_args > q-.O 2> q-.E
34 code=$?
35 if test $code != 0 ; then
36 $echo "Test q- failed: ../../src/ls return code $code differs from expected value 0" 1>&2
37 errors=`expr $errors + 1`
38 else
39 cmp q-.O $srcdir/q-.X > /dev/null 2>&1
40 case $? in
41 0) if test "$VERBOSE" ; then $echo "passed q-"; fi ;;
42 1) $echo "Test q- failed: files q-.O and $srcdir/q-.X differ" 1>&2;
43 errors=`expr $errors + 1` ;;
44 2) $echo "Test q- may have failed." 1>&2;
45 $echo The command "cmp q-.O $srcdir/q-.X" failed. 1>&2 ;
46 errors=`expr $errors + 1` ;;
47 esac
49 test -s q-.E || rm -f q-.E
50 filename_args="$srcdir/quotable\a"
51 new_filename_args=
52 for arg in $filename_args; do
53 if test -r $arg; then
54 basename_arg=`echo $arg|sed 's,.*/,,'`
55 test -f $basename_arg || cp -a $arg .
56 arg=$basename_arg
58 new_filename_args="$new_filename_args $arg"
59 done
60 filename_args=$new_filename_args
62 $xx -N $filename_args > q-N.O 2> q-N.E
63 code=$?
64 if test $code != 0 ; then
65 $echo "Test q-N failed: ../../src/ls return code $code differs from expected value 0" 1>&2
66 errors=`expr $errors + 1`
67 else
68 cmp q-N.O $srcdir/q-N.X > /dev/null 2>&1
69 case $? in
70 0) if test "$VERBOSE" ; then $echo "passed q-N"; fi ;;
71 1) $echo "Test q-N failed: files q-N.O and $srcdir/q-N.X differ" 1>&2;
72 errors=`expr $errors + 1` ;;
73 2) $echo "Test q-N may have failed." 1>&2;
74 $echo The command "cmp q-N.O $srcdir/q-N.X" failed. 1>&2 ;
75 errors=`expr $errors + 1` ;;
76 esac
78 test -s q-N.E || rm -f q-N.E
79 filename_args="$srcdir/quotable\a"
80 new_filename_args=
81 for arg in $filename_args; do
82 if test -r $arg; then
83 basename_arg=`echo $arg|sed 's,.*/,,'`
84 test -f $basename_arg || cp -a $arg .
85 arg=$basename_arg
87 new_filename_args="$new_filename_args $arg"
88 done
89 filename_args=$new_filename_args
91 $xx -q $filename_args > q-q.O 2> q-q.E
92 code=$?
93 if test $code != 0 ; then
94 $echo "Test q-q failed: ../../src/ls return code $code differs from expected value 0" 1>&2
95 errors=`expr $errors + 1`
96 else
97 cmp q-q.O $srcdir/q-q.X > /dev/null 2>&1
98 case $? in
99 0) if test "$VERBOSE" ; then $echo "passed q-q"; fi ;;
100 1) $echo "Test q-q failed: files q-q.O and $srcdir/q-q.X differ" 1>&2;
101 errors=`expr $errors + 1` ;;
102 2) $echo "Test q-q may have failed." 1>&2;
103 $echo The command "cmp q-q.O $srcdir/q-q.X" failed. 1>&2 ;
104 errors=`expr $errors + 1` ;;
105 esac
107 test -s q-q.E || rm -f q-q.E
108 filename_args="$srcdir/quotable\a"
109 new_filename_args=
110 for arg in $filename_args; do
111 if test -r $arg; then
112 basename_arg=`echo $arg|sed 's,.*/,,'`
113 test -f $basename_arg || cp -a $arg .
114 arg=$basename_arg
116 new_filename_args="$new_filename_args $arg"
117 done
118 filename_args=$new_filename_args
120 $xx -Q $filename_args > q-Q.O 2> q-Q.E
121 code=$?
122 if test $code != 0 ; then
123 $echo "Test q-Q failed: ../../src/ls return code $code differs from expected value 0" 1>&2
124 errors=`expr $errors + 1`
125 else
126 cmp q-Q.O $srcdir/q-Q.X > /dev/null 2>&1
127 case $? in
128 0) if test "$VERBOSE" ; then $echo "passed q-Q"; fi ;;
129 1) $echo "Test q-Q failed: files q-Q.O and $srcdir/q-Q.X differ" 1>&2;
130 errors=`expr $errors + 1` ;;
131 2) $echo "Test q-Q may have failed." 1>&2;
132 $echo The command "cmp q-Q.O $srcdir/q-Q.X" failed. 1>&2 ;
133 errors=`expr $errors + 1` ;;
134 esac
136 test -s q-Q.E || rm -f q-Q.E
137 filename_args="$srcdir/q\a"
138 new_filename_args=
139 for arg in $filename_args; do
140 if test -r $arg; then
141 basename_arg=`echo $arg|sed 's,.*/,,'`
142 test -f $basename_arg || cp -a $arg .
143 arg=$basename_arg
145 new_filename_args="$new_filename_args $arg"
146 done
147 filename_args=$new_filename_args
149 $xx --quoting=literal $filename_args > q-qs-lit.O 2> q-qs-lit.E
150 code=$?
151 if test $code != 0 ; then
152 $echo "Test q-qs-lit failed: ../../src/ls return code $code differs from expected value 0" 1>&2
153 errors=`expr $errors + 1`
154 else
155 cmp q-qs-lit.O $srcdir/q-qs-lit.X > /dev/null 2>&1
156 case $? in
157 0) if test "$VERBOSE" ; then $echo "passed q-qs-lit"; fi ;;
158 1) $echo "Test q-qs-lit failed: files q-qs-lit.O and $srcdir/q-qs-lit.X differ" 1>&2;
159 errors=`expr $errors + 1` ;;
160 2) $echo "Test q-qs-lit may have failed." 1>&2;
161 $echo The command "cmp q-qs-lit.O $srcdir/q-qs-lit.X" failed. 1>&2 ;
162 errors=`expr $errors + 1` ;;
163 esac
165 test -s q-qs-lit.E || rm -f q-qs-lit.E
166 filename_args="$srcdir/q\a"
167 new_filename_args=
168 for arg in $filename_args; do
169 if test -r $arg; then
170 basename_arg=`echo $arg|sed 's,.*/,,'`
171 test -f $basename_arg || cp -a $arg .
172 arg=$basename_arg
174 new_filename_args="$new_filename_args $arg"
175 done
176 filename_args=$new_filename_args
178 $xx --quoting=shell $filename_args > q-qs-sh.O 2> q-qs-sh.E
179 code=$?
180 if test $code != 0 ; then
181 $echo "Test q-qs-sh failed: ../../src/ls return code $code differs from expected value 0" 1>&2
182 errors=`expr $errors + 1`
183 else
184 cmp q-qs-sh.O $srcdir/q-qs-sh.X > /dev/null 2>&1
185 case $? in
186 0) if test "$VERBOSE" ; then $echo "passed q-qs-sh"; fi ;;
187 1) $echo "Test q-qs-sh failed: files q-qs-sh.O and $srcdir/q-qs-sh.X differ" 1>&2;
188 errors=`expr $errors + 1` ;;
189 2) $echo "Test q-qs-sh may have failed." 1>&2;
190 $echo The command "cmp q-qs-sh.O $srcdir/q-qs-sh.X" failed. 1>&2 ;
191 errors=`expr $errors + 1` ;;
192 esac
194 test -s q-qs-sh.E || rm -f q-qs-sh.E
195 filename_args="$srcdir/q\a"
196 new_filename_args=
197 for arg in $filename_args; do
198 if test -r $arg; then
199 basename_arg=`echo $arg|sed 's,.*/,,'`
200 test -f $basename_arg || cp -a $arg .
201 arg=$basename_arg
203 new_filename_args="$new_filename_args $arg"
204 done
205 filename_args=$new_filename_args
207 $xx --quoting=shell-always $filename_args > q-qs-sh-a.O 2> q-qs-sh-a.E
208 code=$?
209 if test $code != 0 ; then
210 $echo "Test q-qs-sh-a failed: ../../src/ls return code $code differs from expected value 0" 1>&2
211 errors=`expr $errors + 1`
212 else
213 cmp q-qs-sh-a.O $srcdir/q-qs-sh-a.X > /dev/null 2>&1
214 case $? in
215 0) if test "$VERBOSE" ; then $echo "passed q-qs-sh-a"; fi ;;
216 1) $echo "Test q-qs-sh-a failed: files q-qs-sh-a.O and $srcdir/q-qs-sh-a.X differ" 1>&2;
217 errors=`expr $errors + 1` ;;
218 2) $echo "Test q-qs-sh-a may have failed." 1>&2;
219 $echo The command "cmp q-qs-sh-a.O $srcdir/q-qs-sh-a.X" failed. 1>&2 ;
220 errors=`expr $errors + 1` ;;
221 esac
223 test -s q-qs-sh-a.E || rm -f q-qs-sh-a.E
224 filename_args="$srcdir/q\a"
225 new_filename_args=
226 for arg in $filename_args; do
227 if test -r $arg; then
228 basename_arg=`echo $arg|sed 's,.*/,,'`
229 test -f $basename_arg || cp -a $arg .
230 arg=$basename_arg
232 new_filename_args="$new_filename_args $arg"
233 done
234 filename_args=$new_filename_args
236 $xx --quoting=c $filename_args > q-qs-c.O 2> q-qs-c.E
237 code=$?
238 if test $code != 0 ; then
239 $echo "Test q-qs-c failed: ../../src/ls return code $code differs from expected value 0" 1>&2
240 errors=`expr $errors + 1`
241 else
242 cmp q-qs-c.O $srcdir/q-qs-c.X > /dev/null 2>&1
243 case $? in
244 0) if test "$VERBOSE" ; then $echo "passed q-qs-c"; fi ;;
245 1) $echo "Test q-qs-c failed: files q-qs-c.O and $srcdir/q-qs-c.X differ" 1>&2;
246 errors=`expr $errors + 1` ;;
247 2) $echo "Test q-qs-c may have failed." 1>&2;
248 $echo The command "cmp q-qs-c.O $srcdir/q-qs-c.X" failed. 1>&2 ;
249 errors=`expr $errors + 1` ;;
250 esac
252 test -s q-qs-c.E || rm -f q-qs-c.E
253 filename_args="$srcdir/q\a"
254 new_filename_args=
255 for arg in $filename_args; do
256 if test -r $arg; then
257 basename_arg=`echo $arg|sed 's,.*/,,'`
258 test -f $basename_arg || cp -a $arg .
259 arg=$basename_arg
261 new_filename_args="$new_filename_args $arg"
262 done
263 filename_args=$new_filename_args
265 $xx --quoting=escape $filename_args > q-qs-esc.O 2> q-qs-esc.E
266 code=$?
267 if test $code != 0 ; then
268 $echo "Test q-qs-esc failed: ../../src/ls return code $code differs from expected value 0" 1>&2
269 errors=`expr $errors + 1`
270 else
271 cmp q-qs-esc.O $srcdir/q-qs-esc.X > /dev/null 2>&1
272 case $? in
273 0) if test "$VERBOSE" ; then $echo "passed q-qs-esc"; fi ;;
274 1) $echo "Test q-qs-esc failed: files q-qs-esc.O and $srcdir/q-qs-esc.X differ" 1>&2;
275 errors=`expr $errors + 1` ;;
276 2) $echo "Test q-qs-esc may have failed." 1>&2;
277 $echo The command "cmp q-qs-esc.O $srcdir/q-qs-esc.X" failed. 1>&2 ;
278 errors=`expr $errors + 1` ;;
279 esac
281 test -s q-qs-esc.E || rm -f q-qs-esc.E
282 if test $errors = 0 ; then
283 $echo Passed all 9 tests. 1>&2
284 else
285 $echo Failed $errors tests. 1>&2
287 test $errors = 0 || errors=1
288 exit $errors