Optimie x86-64 SSE4 memcmp for unaligned data.
[glibc.git] / posix / globtest.sh
blobaadac877964d7c59d8c8c6d8356d8ccc0bd3cc73
1 #! /bin/bash
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=$(mktemp -d $TMPDIR/globtest-dir.XXXXXX)
32 testout=$(mktemp $TMPDIR/globtest-out.XXXXXX)
34 trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
36 echo 1 > $testdir/file1
37 echo 2 > $testdir/file2
38 echo 3 > $testdir/-file3
39 echo 4 > $testdir/~file4
40 echo 5 > $testdir/.file5
41 echo 6 > $testdir/'*file6'
42 echo 7 > $testdir/'{file7,}'
43 echo 8 > $testdir/'\{file8\}'
44 echo 9 > $testdir/'\{file9\,file9b\}'
45 echo 9 > $testdir/'\file9b\' #'
46 echo a > $testdir/'filea,'
47 echo a > $testdir/'fileb}c'
48 mkdir $testdir/dir1
49 mkdir $testdir/dir2
50 test -d $testdir/noread || mkdir $testdir/noread
51 chmod a-r $testdir/noread
52 echo 1_1 > $testdir/dir1/file1_1
53 echo 1_2 > $testdir/dir1/file1_2
54 ln -fs dir1 $testdir/link1
56 # Run some tests.
57 result=0
58 rm -f $logfile
60 # Normal test
61 failed=0
62 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
63 ${common_objpfx}posix/globtest "$testdir" "*" |
64 sort > $testout
65 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
66 `*file6'
67 `-file3'
68 `\file9b\'
69 `\{file8\}'
70 `\{file9\,file9b\}'
71 `dir1'
72 `dir2'
73 `file1'
74 `file2'
75 `filea,'
76 `fileb}c'
77 `link1'
78 `noread'
79 `{file7,}'
80 `~file4'
81 EOF
82 if test $failed -ne 0; then
83 echo "Normal test failed" >> $logfile
84 result=1
87 # Don't let glob sort it
88 failed=0
89 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
90 ${common_objpfx}posix/globtest -s "$testdir" "*" |
91 sort > $testout
92 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
93 `*file6'
94 `-file3'
95 `\file9b\'
96 `\{file8\}'
97 `\{file9\,file9b\}'
98 `dir1'
99 `dir2'
100 `file1'
101 `file2'
102 `filea,'
103 `fileb}c'
104 `link1'
105 `noread'
106 `{file7,}'
107 `~file4'
109 if test $failed -ne 0; then
110 echo "No sort test failed" >> $logfile
111 result=1
114 # Mark directories
115 failed=0
116 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
117 ${common_objpfx}posix/globtest -m "$testdir" "*" |
118 sort > $testout
119 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
120 `*file6'
121 `-file3'
122 `\file9b\'
123 `\{file8\}'
124 `\{file9\,file9b\}'
125 `dir1/'
126 `dir2/'
127 `file1'
128 `file2'
129 `filea,'
130 `fileb}c'
131 `link1/'
132 `noread/'
133 `{file7,}'
134 `~file4'
136 if test $failed -ne 0; then
137 echo "Mark directories test failed" >> $logfile
138 result=1
141 # Find files starting with .
142 failed=0
143 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
144 ${common_objpfx}posix/globtest -p "$testdir" "*" |
145 sort > $testout
146 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
147 `*file6'
148 `-file3'
150 `..'
151 `.file5'
152 `\file9b\'
153 `\{file8\}'
154 `\{file9\,file9b\}'
155 `dir1'
156 `dir2'
157 `file1'
158 `file2'
159 `filea,'
160 `fileb}c'
161 `link1'
162 `noread'
163 `{file7,}'
164 `~file4'
166 if test $failed -ne 0; then
167 echo "Leading period test failed" >> $logfile
168 result=1
171 # Test braces
172 failed=0
173 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
174 ${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
175 sort > $testout
176 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
177 `file1'
178 `file2'
180 if test $failed -ne 0; then
181 echo "Braces test failed" >> $logfile
182 result=1
185 failed=0
186 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
187 ${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
188 sort > $testout
189 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
190 `-file3'
191 `file1'
192 `file2'
194 if test $failed -ne 0; then
195 echo "Braces test 2 failed" >> $logfile
196 result=1
199 failed=0
200 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
201 ${common_objpfx}posix/globtest -b "$testdir" "{" |
202 sort > $testout
203 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
204 GLOB_NOMATCH
206 if test $failed -ne 0; then
207 echo "Braces test 3 failed" >> $logfile
208 result=1
211 # Test NOCHECK
212 failed=0
213 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
214 ${common_objpfx}posix/globtest -c "$testdir" "abc" |
215 sort > $testout
216 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
217 `abc'
219 if test $failed -ne 0; then
220 echo "No check test failed" >> $logfile
221 result=1
224 # Test NOMAGIC without magic characters
225 failed=0
226 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
227 ${common_objpfx}posix/globtest -g "$testdir" "abc" |
228 sort > $testout
229 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
230 `abc'
232 if test $failed -ne 0; then
233 echo "No magic test failed" >> $logfile
234 result=1
237 # Test NOMAGIC with magic characters
238 failed=0
239 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
240 ${common_objpfx}posix/globtest -g "$testdir" "abc*" |
241 sort > $testout
242 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
243 GLOB_NOMATCH
245 if test $failed -ne 0; then
246 echo "No magic w/ magic chars test failed" >> $logfile
247 result=1
250 # Test NOMAGIC for subdirs
251 failed=0
252 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
253 ${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
254 sort > $testout
255 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
256 GLOB_NOMATCH
258 if test $failed -ne 0; then
259 echo "No magic in subdir test failed" >> $logfile
260 result=1
263 # Test subdirs correctly
264 failed=0
265 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
266 ${common_objpfx}posix/globtest "$testdir" "*/*" |
267 sort > $testout
268 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
269 `dir1/file1_1'
270 `dir1/file1_2'
271 `link1/file1_1'
272 `link1/file1_2'
274 if test $failed -ne 0; then
275 echo "Subdirs test failed" >> $logfile
276 result=1
279 # Test subdirs for invalid names
280 failed=0
281 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
282 ${common_objpfx}posix/globtest "$testdir" "*/1" |
283 sort > $testout
284 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
285 GLOB_NOMATCH
287 if test $failed -ne 0; then
288 echo "Invalid subdir test failed" >> $logfile
289 result=1
292 # Test subdirs with wildcard
293 failed=0
294 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
295 ${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
296 sort > $testout
297 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
298 `dir1/file1_1'
299 `link1/file1_1'
301 if test $failed -ne 0; then
302 echo "Wildcard subdir test failed" >> $logfile
303 result=1
306 # Test subdirs with ?
307 failed=0
308 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
309 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
310 sort > $testout
311 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
312 `dir1/file1_1'
313 `dir1/file1_2'
314 `link1/file1_1'
315 `link1/file1_2'
317 if test $failed -ne 0; then
318 echo "Wildcard2 subdir test failed" >> $logfile
319 result=1
322 failed=0
323 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
324 ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
325 sort > $testout
326 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
327 `dir1/file1_1'
328 `link1/file1_1'
330 if test $failed -ne 0; then
331 echo "Wildcard3 subdir test failed" >> $logfile
332 result=1
335 failed=0
336 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
337 ${common_objpfx}posix/globtest "$testdir" "*-/*" |
338 sort > $testout
339 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
340 GLOB_NOMATCH
342 if test $failed -ne 0; then
343 echo "Wildcard4 subdir test failed" >> $logfile
344 result=1
347 failed=0
348 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
349 ${common_objpfx}posix/globtest "$testdir" "*-" |
350 sort > $testout
351 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
352 GLOB_NOMATCH
354 if test $failed -ne 0; then
355 echo "Wildcard5 subdir test failed" >> $logfile
356 result=1
359 # Test subdirs with ?
360 failed=0
361 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
362 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
363 sort > $testout
364 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
365 `dir1/file1_1'
366 `dir1/file1_2'
367 `link1/file1_1'
368 `link1/file1_2'
370 if test $failed -ne 0; then
371 echo "Wildcard6 subdir test failed" >> $logfile
372 result=1
375 # Test subdirs with [ .. ]
376 failed=0
377 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
378 ${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
379 sort > $testout
380 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
381 `dir1/file1_1'
382 `dir1/file1_2'
383 `link1/file1_1'
384 `link1/file1_2'
386 if test $failed -ne 0; then
387 echo "Brackets test failed" >> $logfile
388 result=1
391 # Test ']' inside bracket expression
392 failed=0
393 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
394 ${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
395 sort > $testout
396 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
397 `dir1/file1_1'
398 `dir1/file1_2'
400 if test $failed -ne 0; then
401 echo "Brackets2 test failed" >> $logfile
402 result=1
405 # Test tilde expansion
406 failed=0
407 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
408 ${common_objpfx}posix/globtest -q -t "$testdir" "~" |
409 sort >$testout
410 echo ~ | $CMP - $testout >> $logfile || failed=1
411 if test $failed -ne 0; then
412 if test -d ~; then
413 echo "Tilde test failed" >> $logfile
414 result=1
415 else
416 echo "Tilde test could not be run" >> $logfile
420 # Test tilde expansion with trailing slash
421 failed=0
422 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
423 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
424 sort > $testout
425 # Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
426 if test ~/ = //; then
427 echo / | $CMP - $testout >> $logfile || failed=1
428 else
429 echo ~/ | $CMP - $testout >> $logfile || failed=1
431 if test $failed -ne 0; then
432 if test -d ~/; then
433 echo "Tilde2 test failed" >> $logfile
434 result=1
435 else
436 echo "Tilde2 test could not be run" >> $logfile
440 # Test tilde expansion with username
441 failed=0
442 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
443 ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
444 sort > $testout
445 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
446 if test $failed -ne 0; then
447 if eval test -d ~$USER; then
448 echo "Tilde3 test failed" >> $logfile
449 result=1
450 else
451 echo "Tilde3 test could not be run" >> $logfile
455 # Tilde expansion shouldn't match a file
456 failed=0
457 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
458 ${common_objpfx}posix/globtest -T "$testdir" "~file4" |
459 sort > $testout
460 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
461 GLOB_NOMATCH
463 if test $failed -ne 0; then
464 echo "Tilde4 test failed" >> $logfile
465 result=1
468 # Matching \** should only find *file6
469 failed=0
470 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
471 ${common_objpfx}posix/globtest "$testdir" "\**" |
472 sort > $testout
473 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
474 `*file6'
476 if test $failed -ne 0; then
477 echo "Star test failed" >> $logfile
478 result=1
481 # ... unless NOESCAPE is used, in which case it should entries with a
482 # leading \.
483 failed=0
484 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
485 ${common_objpfx}posix/globtest -e "$testdir" "\**" |
486 sort > $testout
487 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
488 `\file9b\'
489 `\{file8\}'
490 `\{file9\,file9b\}'
492 if test $failed -ne 0; then
493 echo "Star2 test failed" >> $logfile
494 result=1
497 # Matching \*file6 should find *file6
498 failed=0
499 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
500 ${common_objpfx}posix/globtest "$testdir" "\*file6" |
501 sort > $testout
502 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
503 `*file6'
505 if test $failed -ne 0; then
506 echo "Star3 test failed" >> $logfile
507 result=1
510 # GLOB_BRACE alone
511 failed=0
512 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
513 ${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
514 sort > $testout
515 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
516 `{file7,}'
518 if test $failed -ne 0; then
519 echo "Brace4 test failed" >> $logfile
520 result=1
523 # GLOB_BRACE and GLOB_NOESCAPE
524 failed=0
525 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
526 ${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
527 sort > $testout
528 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
529 `\file9b\'
531 if test $failed -ne 0; then
532 echo "Brace5 test failed" >> $logfile
533 result=1
536 # Escaped comma
537 failed=0
538 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
539 ${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
540 sort > $testout
541 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
542 `filea,'
544 if test $failed -ne 0; then
545 echo "Brace6 test failed" >> $logfile
546 result=1
549 # Escaped closing brace
550 failed=0
551 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
552 ${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
553 sort > $testout
554 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
555 `fileb}c'
557 if test $failed -ne 0; then
558 echo "Brace7 test failed" >> $logfile
559 result=1
562 # Try a recursive failed search
563 failed=0
564 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
565 ${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
566 sort > $testout
567 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
568 GLOB_NOMATCH
570 if test $failed -ne 0; then
571 echo "Star4 test failed" >> $logfile
572 result=1
575 # ... with GLOB_ERR
576 failed=0
577 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
578 ${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
579 sort > $testout
580 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
581 GLOB_NOMATCH
583 if test $failed -ne 0; then
584 echo "Star5 test failed" >> $logfile
585 result=1
588 # Try a recursive search in unreadable directory
589 failed=0
590 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
591 ${common_objpfx}posix/globtest "$testdir" "noread/*" |
592 sort > $testout
593 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
594 GLOB_NOMATCH
596 if test $failed -ne 0; then
597 echo "Star6 test failed" >> $logfile
598 result=1
601 failed=0
602 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
603 ${common_objpfx}posix/globtest "$testdir" "noread*/*" |
604 sort > $testout
605 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
606 GLOB_NOMATCH
608 if test $failed -ne 0; then
609 echo "Star6 test failed" >> $logfile
610 result=1
613 # The following tests will fail if run as root.
614 user=`id -un 2> /dev/null`
615 if test -z "$user"; then
616 uid="$USER"
618 if test "$user" != root; then
619 # ... with GLOB_ERR
620 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
621 ${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
622 sort > $testout
623 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
624 GLOB_ABORTED
627 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
628 ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
629 sort > $testout
630 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
631 GLOB_ABORTED
633 if test $failed -ne 0; then
634 echo "GLOB_ERR test failed" >> $logfile
635 result=1
637 fi # not run as root
639 # Try multiple patterns (GLOB_APPEND)
640 failed=0
641 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
642 ${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
643 sort > $testout
644 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
645 `dir1/file1_1'
646 `dir1/file1_2'
647 `file1'
648 `link1/file1_1'
649 `link1/file1_2'
651 if test $failed -ne 0; then
652 echo "GLOB_APPEND test failed" >> $logfile
653 result=1
656 # Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
657 failed=0
658 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
659 ${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
660 sort > $testout
661 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
662 `abc'
663 `dir1/file1_1'
664 `dir1/file1_2'
665 `file1'
666 `link1/file1_1'
667 `link1/file1_2'
669 if test $failed -ne 0; then
670 echo "GLOB_APPEND2 test failed" >> $logfile
671 result=1
674 # Test NOCHECK with non-existing file in subdir.
675 failed=0
676 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
677 ${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
678 sort > $testout
679 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
680 `*/blahblah'
682 if test $failed -ne 0; then
683 echo "No check2 test failed" >> $logfile
684 result=1
687 # Test [[:punct:]] not matching leading period.
688 failed=0
689 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
690 ${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
691 sort > $testout
692 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
693 `*file6'
694 `-file3'
695 `\file9b\'
696 `\{file8\}'
697 `\{file9\,file9b\}'
698 `{file7,}'
699 `~file4'
701 if test $failed -ne 0; then
702 echo "Punct test failed" >> $logfile
703 result=1
706 mkdir $testdir/'dir3*'
707 echo 1 > $testdir/'dir3*'/file1
708 mkdir $testdir/'dir4[a'
709 echo 2 > $testdir/'dir4[a'/file1
710 echo 3 > $testdir/'dir4[a'/file2
711 mkdir $testdir/'dir5[ab]'
712 echo 4 > $testdir/'dir5[ab]'/file1
713 echo 5 > $testdir/'dir5[ab]'/file2
714 mkdir $testdir/dir6
715 echo 6 > $testdir/dir6/'file1[a'
716 echo 7 > $testdir/dir6/'file1[ab]'
717 failed=0
718 v=`${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
719 ${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
720 test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1
721 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
722 ${common_objpfx}posix/globtest -c "$testdir" \
723 'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \
724 'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \
725 'dir6/fil*[a' 'dir*6/file1[a' 'dir6/fi*l[ab]' 'dir*6/file1[ab]' |
726 sort > $testout
727 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
728 `di*r4[a/file2'
729 `dir*6/file1[a'
730 `dir*6/file1[ab]'
731 `dir1/file1_1'
732 `dir1/file\1_9'
733 `dir2/'
734 `dir3*/file1'
735 `dir3\*/file2'
736 `dir4[a/fil*1'
737 `dir5[ab]/file[12]'
738 `dir6/fi*l[ab]'
739 `dir6/fil*[a'
740 `nondir\/'
742 HOME="$testdir" \
743 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
744 ${common_objpfx}posix/globtest -ct "$testdir" \
745 '~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
746 '~\/dir1/file1_2' |
747 sort > $testout
748 cat <<EOF | $CMP - $testout >> $logfile || failed=1
749 \`$testdir/dir1/file1_1'
750 \`$testdir/dir1/file1_2'
751 \`$testdir/dir3*/file1'
752 \`~/dir1/file1_9'
753 \`~/dir3\\*/file2'
755 if eval test -d ~"$USER"/; then
756 user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'`
757 if test -n "$user"; then
758 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
759 ${common_objpfx}posix/globtest -ctq "$testdir" "$user/" |
760 sort > $testout
761 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
762 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
763 ${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" |
764 sort > $testout
765 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
766 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
767 ${common_objpfx}posix/globtest -ctq "$testdir" "$user" |
768 sort > $testout
769 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
772 if test $failed -ne 0; then
773 echo "Escape tests failed" >> $logfile
774 result=1
777 if test $result -eq 0; then
778 chmod 777 $testdir/noread
779 rm -fr $testdir $testout
780 echo "All OK." > $logfile
783 exit $result
785 # Preserve executable bits for this shell script.
786 Local Variables:
787 eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
788 eval:(make-local-variable 'file-mode)
789 eval:(setq file-mode (file-modes (buffer-file-name)))
790 eval:(make-local-variable 'after-save-hook)
791 eval:(add-hook 'after-save-hook 'frobme)
792 End: