* elf/Makefile (tests): Substitute tests-vis-yes here.
[glibc.git] / posix / globtest.sh
blobad47508a665bdb905b9c5075e12bcea7d417cfb1
1 #! /bin/sh
3 common_objpfx=$1; shift
4 elf_objpfx=$1; shift
5 rtld_installed_name=$1; shift
6 logfile=$common_objpfx/posix/globtest.out
8 #CMP=cmp
9 CMP="diff -u"
11 # We have to make the paths `common_objpfx' absolute.
12 case "$common_objpfx" in
13 .*)
14 common_objpfx="`pwd`/$common_objpfx"
18 esac
20 # We have to find the libc and the NSS modules.
21 library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
23 # Since we use `sort' we must make sure to use the same locale everywhere.
24 LC_ALL=C
25 export LC_ALL
26 LANG=C
27 export LANG
29 # Create the arena
30 : ${TMPDIR=/tmp}
31 testdir=$TMPDIR/globtest-dir
32 testout=$TMPDIR/globtest-out
34 trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
36 test -d $testdir/noread && chmod 777 $testdir/noread
37 rm -fr $testdir 2>/dev/null
38 mkdir $testdir
39 echo 1 > $testdir/file1
40 echo 2 > $testdir/file2
41 echo 3 > $testdir/-file3
42 echo 4 > $testdir/~file4
43 echo 5 > $testdir/.file5
44 echo 6 > $testdir/'*file6'
45 echo 7 > $testdir/'{file7,}'
46 echo 8 > $testdir/'\{file8\}'
47 echo 9 > $testdir/'\{file9\,file9b\}'
48 echo 9 > $testdir/'\file9b\' #'
49 echo a > $testdir/'filea,'
50 echo a > $testdir/'fileb}c'
51 mkdir $testdir/dir1
52 mkdir $testdir/dir2
53 test -d $testdir/noread || mkdir $testdir/noread
54 chmod a-r $testdir/noread
55 echo 1_1 > $testdir/dir1/file1_1
56 echo 1_2 > $testdir/dir1/file1_2
57 ln -fs dir1 $testdir/link1
59 # Run some tests.
60 result=0
61 rm -f $logfile
63 # Normal test
64 failed=0
65 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
66 ${common_objpfx}posix/globtest "$testdir" "*" |
67 sort > $testout
68 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
69 `*file6'
70 `-file3'
71 `\file9b\'
72 `\{file8\}'
73 `\{file9\,file9b\}'
74 `dir1'
75 `dir2'
76 `file1'
77 `file2'
78 `filea,'
79 `fileb}c'
80 `link1'
81 `noread'
82 `{file7,}'
83 `~file4'
84 EOF
85 if test $failed -ne 0; then
86 echo "Normal test failed" >> $logfile
87 result=1
90 # Don't let glob sort it
91 failed=0
92 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
93 ${common_objpfx}posix/globtest -s "$testdir" "*" |
94 sort > $testout
95 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
96 `*file6'
97 `-file3'
98 `\file9b\'
99 `\{file8\}'
100 `\{file9\,file9b\}'
101 `dir1'
102 `dir2'
103 `file1'
104 `file2'
105 `filea,'
106 `fileb}c'
107 `link1'
108 `noread'
109 `{file7,}'
110 `~file4'
112 if test $failed -ne 0; then
113 echo "No sort test failed" >> $logfile
114 result=1
117 # Mark directories
118 failed=0
119 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
120 ${common_objpfx}posix/globtest -m "$testdir" "*" |
121 sort > $testout
122 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
123 `*file6'
124 `-file3'
125 `\file9b\'
126 `\{file8\}'
127 `\{file9\,file9b\}'
128 `dir1/'
129 `dir2/'
130 `file1'
131 `file2'
132 `filea,'
133 `fileb}c'
134 `link1/'
135 `noread/'
136 `{file7,}'
137 `~file4'
139 if test $failed -ne 0; then
140 echo "Mark directories test failed" >> $logfile
141 result=1
144 # Find files starting with .
145 failed=0
146 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
147 ${common_objpfx}posix/globtest -p "$testdir" "*" |
148 sort > $testout
149 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
150 `*file6'
151 `-file3'
153 `..'
154 `.file5'
155 `\file9b\'
156 `\{file8\}'
157 `\{file9\,file9b\}'
158 `dir1'
159 `dir2'
160 `file1'
161 `file2'
162 `filea,'
163 `fileb}c'
164 `link1'
165 `noread'
166 `{file7,}'
167 `~file4'
169 if test $failed -ne 0; then
170 echo "Leading period test failed" >> $logfile
171 result=1
174 # Test braces
175 failed=0
176 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
177 ${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
178 sort > $testout
179 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
180 `file1'
181 `file2'
183 if test $failed -ne 0; then
184 echo "Braces test failed" >> $logfile
185 result=1
188 failed=0
189 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
190 ${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
191 sort > $testout
192 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
193 `-file3'
194 `file1'
195 `file2'
197 if test $failed -ne 0; then
198 echo "Braces test 2 failed" >> $logfile
199 result=1
202 failed=0
203 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
204 ${common_objpfx}posix/globtest -b "$testdir" "{" |
205 sort > $testout
206 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
207 GLOB_NOMATCH
209 if test $failed -ne 0; then
210 echo "Braces test 3 failed" >> $logfile
211 result=1
214 # Test NOCHECK
215 failed=0
216 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
217 ${common_objpfx}posix/globtest -c "$testdir" "abc" |
218 sort > $testout
219 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
220 `abc'
222 if test $failed -ne 0; then
223 echo "No check test failed" >> $logfile
224 result=1
227 # Test NOMAGIC without magic characters
228 failed=0
229 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
230 ${common_objpfx}posix/globtest -g "$testdir" "abc" |
231 sort > $testout
232 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
233 `abc'
235 if test $failed -ne 0; then
236 echo "No magic test failed" >> $logfile
237 result=1
240 # Test NOMAGIC with magic characters
241 failed=0
242 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
243 ${common_objpfx}posix/globtest -g "$testdir" "abc*" |
244 sort > $testout
245 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
246 GLOB_NOMATCH
248 if test $failed -ne 0; then
249 echo "No magic w/ magic chars test failed" >> $logfile
250 result=1
253 # Test NOMAGIC for subdirs
254 failed=0
255 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
256 ${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
257 sort > $testout
258 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
259 GLOB_NOMATCH
261 if test $failed -ne 0; then
262 echo "No magic in subdir test failed" >> $logfile
263 result=1
266 # Test subdirs correctly
267 failed=0
268 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
269 ${common_objpfx}posix/globtest "$testdir" "*/*" |
270 sort > $testout
271 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
272 `dir1/file1_1'
273 `dir1/file1_2'
274 `link1/file1_1'
275 `link1/file1_2'
277 if test $failed -ne 0; then
278 echo "Subdirs test failed" >> $logfile
279 result=1
282 # Test subdirs for invalid names
283 failed=0
284 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
285 ${common_objpfx}posix/globtest "$testdir" "*/1" |
286 sort > $testout
287 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
288 GLOB_NOMATCH
290 if test $failed -ne 0; then
291 echo "Invalid subdir test failed" >> $logfile
292 result=1
295 # Test subdirs with wildcard
296 failed=0
297 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
298 ${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
299 sort > $testout
300 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
301 `dir1/file1_1'
302 `link1/file1_1'
304 if test $failed -ne 0; then
305 echo "Wildcard subdir test failed" >> $logfile
306 result=1
309 # Test subdirs with ?
310 failed=0
311 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
312 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
313 sort > $testout
314 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
315 `dir1/file1_1'
316 `dir1/file1_2'
317 `link1/file1_1'
318 `link1/file1_2'
320 if test $failed -ne 0; then
321 echo "Wildcard2 subdir test failed" >> $logfile
322 result=1
325 failed=0
326 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
327 ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
328 sort > $testout
329 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
330 `dir1/file1_1'
331 `link1/file1_1'
333 if test $failed -ne 0; then
334 echo "Wildcard3 subdir test failed" >> $logfile
335 result=1
338 failed=0
339 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
340 ${common_objpfx}posix/globtest "$testdir" "*-/*" |
341 sort > $testout
342 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
343 GLOB_NOMATCH
345 if test $failed -ne 0; then
346 echo "Wildcard4 subdir test failed" >> $logfile
347 result=1
350 failed=0
351 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
352 ${common_objpfx}posix/globtest "$testdir" "*-" |
353 sort > $testout
354 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
355 GLOB_NOMATCH
357 if test $failed -ne 0; then
358 echo "Wildcard5 subdir test failed" >> $logfile
359 result=1
362 # Test subdirs with ?
363 failed=0
364 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
365 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
366 sort > $testout
367 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
368 `dir1/file1_1'
369 `dir1/file1_2'
370 `link1/file1_1'
371 `link1/file1_2'
373 if test $failed -ne 0; then
374 echo "Wildcard6 subdir test failed" >> $logfile
375 result=1
378 # Test subdirs with [ .. ]
379 failed=0
380 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
381 ${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
382 sort > $testout
383 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
384 `dir1/file1_1'
385 `dir1/file1_2'
386 `link1/file1_1'
387 `link1/file1_2'
389 if test $failed -ne 0; then
390 echo "Brackets test failed" >> $logfile
391 result=1
394 # Test ']' inside bracket expression
395 failed=0
396 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
397 ${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
398 sort > $testout
399 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
400 `dir1/file1_1'
401 `dir1/file1_2'
403 if test $failed -ne 0; then
404 echo "Brackets2 test failed" >> $logfile
405 result=1
408 # Test tilde expansion
409 failed=0
410 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
411 ${common_objpfx}posix/globtest -q -t "$testdir" "~" |
412 sort >$testout
413 echo ~ | $CMP - $testout >> $logfile || failed=1
414 if test $failed -ne 0; then
415 if test -d ~; then
416 echo "Tilde test failed" >> $logfile
417 result=1
418 else
419 echo "Tilde test could not be run" >> $logfile
423 # Test tilde expansion with trailing slash
424 failed=0
425 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
426 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
427 sort > $testout
428 # Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
429 if test ~/ = //; then
430 echo / | $CMP - $testout >> $logfile || failed=1
431 else
432 echo ~/ | $CMP - $testout >> $logfile || failed=1
434 if test $failed -ne 0; then
435 if test -d ~/; then
436 echo "Tilde2 test failed" >> $logfile
437 result=1
438 else
439 echo "Tilde2 test could not be run" >> $logfile
443 # Test tilde expansion with username
444 failed=0
445 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
446 ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
447 sort > $testout
448 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
449 if test $failed -ne 0; then
450 if eval test -d ~$USER; then
451 echo "Tilde3 test failed" >> $logfile
452 result=1
453 else
454 echo "Tilde3 test could not be run" >> $logfile
458 # Tilde expansion shouldn't match a file
459 failed=0
460 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
461 ${common_objpfx}posix/globtest -T "$testdir" "~file4" |
462 sort > $testout
463 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
464 GLOB_NOMATCH
466 if test $failed -ne 0; then
467 echo "Tilde4 test failed" >> $logfile
468 result=1
471 # Matching \** should only find *file6
472 failed=0
473 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
474 ${common_objpfx}posix/globtest "$testdir" "\**" |
475 sort > $testout
476 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
477 `*file6'
479 if test $failed -ne 0; then
480 echo "Star test failed" >> $logfile
481 result=1
484 # ... unless NOESCAPE is used, in which case it should entries with a
485 # leading \.
486 failed=0
487 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
488 ${common_objpfx}posix/globtest -e "$testdir" "\**" |
489 sort > $testout
490 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
491 `\file9b\'
492 `\{file8\}'
493 `\{file9\,file9b\}'
495 if test $failed -ne 0; then
496 echo "Star2 test failed" >> $logfile
497 result=1
500 # Matching \*file6 should find *file6
501 failed=0
502 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
503 ${common_objpfx}posix/globtest "$testdir" "\*file6" |
504 sort > $testout
505 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
506 `*file6'
508 if test $failed -ne 0; then
509 echo "Star3 test failed" >> $logfile
510 result=1
513 # GLOB_BRACE alone
514 failed=0
515 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
516 ${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
517 sort > $testout
518 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
519 `{file7,}'
521 if test $failed -ne 0; then
522 echo "Brace4 test failed" >> $logfile
523 result=1
526 # GLOB_BRACE and GLOB_NOESCAPE
527 failed=0
528 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
529 ${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
530 sort > $testout
531 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
532 `\file9b\'
534 if test $failed -ne 0; then
535 echo "Brace5 test failed" >> $logfile
536 result=1
539 # Escaped comma
540 failed=0
541 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
542 ${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
543 sort > $testout
544 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
545 `filea,'
547 if test $failed -ne 0; then
548 echo "Brace6 test failed" >> $logfile
549 result=1
552 # Escaped closing brace
553 failed=0
554 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
555 ${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
556 sort > $testout
557 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
558 `fileb}c'
560 if test $failed -ne 0; then
561 echo "Brace7 test failed" >> $logfile
562 result=1
565 # Try a recursive failed search
566 failed=0
567 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
568 ${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
569 sort > $testout
570 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
571 GLOB_NOMATCH
573 if test $failed -ne 0; then
574 echo "Star4 test failed" >> $logfile
575 result=1
578 # ... with GLOB_ERR
579 failed=0
580 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
581 ${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
582 sort > $testout
583 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
584 GLOB_NOMATCH
586 if test $failed -ne 0; then
587 echo "Star5 test failed" >> $logfile
588 result=1
591 # Try a recursive search in unreadable directory
592 failed=0
593 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
594 ${common_objpfx}posix/globtest "$testdir" "noread/*" |
595 sort > $testout
596 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
597 GLOB_NOMATCH
599 if test $failed -ne 0; then
600 echo "Star6 test failed" >> $logfile
601 result=1
604 failed=0
605 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
606 ${common_objpfx}posix/globtest "$testdir" "noread*/*" |
607 sort > $testout
608 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
609 GLOB_NOMATCH
611 if test $failed -ne 0; then
612 echo "Star6 test failed" >> $logfile
613 result=1
616 # The following tests will fail if run as root.
617 user=`id -un 2> /dev/null`
618 if test -z "$user"; then
619 uid="$USER"
621 if test "$user" != root; then
622 # ... with GLOB_ERR
623 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
624 ${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
625 sort > $testout
626 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
627 GLOB_ABORTED
630 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
631 ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
632 sort > $testout
633 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
634 GLOB_ABORTED
636 if test $failed -ne 0; then
637 echo "GLOB_ERR test failed" >> $logfile
638 result=1
640 fi # not run as root
642 # Try multiple patterns (GLOB_APPEND)
643 failed=0
644 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
645 ${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
646 sort > $testout
647 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
648 `dir1/file1_1'
649 `dir1/file1_2'
650 `file1'
651 `link1/file1_1'
652 `link1/file1_2'
654 if test $failed -ne 0; then
655 echo "GLOB_APPEND test failed" >> $logfile
656 result=1
659 # Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
660 failed=0
661 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
662 ${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
663 sort > $testout
664 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
665 `abc'
666 `dir1/file1_1'
667 `dir1/file1_2'
668 `file1'
669 `link1/file1_1'
670 `link1/file1_2'
672 if test $failed -ne 0; then
673 echo "GLOB_APPEND2 test failed" >> $logfile
674 result=1
677 # Test NOCHECK with non-existing file in subdir.
678 failed=0
679 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
680 ${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
681 sort > $testout
682 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
683 `*/blahblah'
685 if test $failed -ne 0; then
686 echo "No check2 test failed" >> $logfile
687 result=1
690 # Test [[:punct:]] not matching leading period.
691 failed=0
692 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
693 ${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
694 sort > $testout
695 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
696 `*file6'
697 `-file3'
698 `\file9b\'
699 `\{file8\}'
700 `\{file9\,file9b\}'
701 `{file7,}'
702 `~file4'
704 if test $failed -ne 0; then
705 echo "Punct test failed" >> $logfile
706 result=1
709 mkdir $testdir/'dir3*'
710 echo 1 > $testdir/'dir3*'/file1
711 mkdir $testdir/'dir4[a'
712 echo 2 > $testdir/'dir4[a'/file1
713 echo 3 > $testdir/'dir4[a'/file2
714 mkdir $testdir/'dir5[ab]'
715 echo 4 > $testdir/'dir5[ab]'/file1
716 echo 5 > $testdir/'dir5[ab]'/file2
717 mkdir $testdir/dir6
718 echo 6 > $testdir/dir6/'file1[a'
719 echo 7 > $testdir/dir6/'file1[ab]'
720 failed=0
721 v=`${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
722 ${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
723 test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1
724 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
725 ${common_objpfx}posix/globtest -c "$testdir" \
726 'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \
727 'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \
728 'dir6/fil*[a' 'dir*6/file1[a' 'dir6/fi*l[ab]' 'dir*6/file1[ab]' |
729 sort > $testout
730 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
731 `di*r4[a/file2'
732 `dir*6/file1[a'
733 `dir*6/file1[ab]'
734 `dir1/file1_1'
735 `dir1/file\1_9'
736 `dir2/'
737 `dir3*/file1'
738 `dir3\*/file2'
739 `dir4[a/fil*1'
740 `dir5[ab]/file[12]'
741 `dir6/fi*l[ab]'
742 `dir6/fil*[a'
743 `nondir\/'
745 HOME="$testdir" \
746 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
747 ${common_objpfx}posix/globtest -ct "$testdir" \
748 '~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
749 '~\/dir1/file1_2' |
750 sort > $testout
751 cat <<EOF | $CMP - $testout >> $logfile || failed=1
752 \`$testdir/dir1/file1_1'
753 \`$testdir/dir1/file1_2'
754 \`$testdir/dir3*/file1'
755 \`~/dir1/file1_9'
756 \`~/dir3\\*/file2'
758 if eval test -d ~"$USER"/; then
759 user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'`
760 if test -n "$user"; then
761 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
762 ${common_objpfx}posix/globtest -ctq "$testdir" "$user/" |
763 sort > $testout
764 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
765 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
766 ${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" |
767 sort > $testout
768 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
769 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
770 ${common_objpfx}posix/globtest -ctq "$testdir" "$user" |
771 sort > $testout
772 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
775 if test $failed -ne 0; then
776 echo "Escape tests failed" >> $logfile
777 result=1
780 if test $result -eq 0; then
781 chmod 777 $testdir/noread
782 rm -fr $testdir $testout
783 echo "All OK." > $logfile
786 exit $result
788 # Preserve executable bits for this shell script.
789 Local Variables:
790 eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
791 eval:(make-local-variable 'file-mode)
792 eval:(setq file-mode (file-modes (buffer-file-name)))
793 eval:(make-local-variable 'after-save-hook)
794 eval:(add-hook 'after-save-hook 'frobme)
795 End: