Remove sysdeps/i386/i486/Versions
[glibc.git] / posix / globtest.sh
blob7c9f590167ccbb9f8ac71eeb6cf14ae534f6eb1c
1 #! /bin/bash
2 # Test for glob(3).
3 # Copyright (C) 1997-2015 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <http://www.gnu.org/licenses/>.
20 set -e
22 common_objpfx=$1; shift
23 test_via_rtld_prefix=$1; shift
24 test_program_prefix=$1; shift
25 test_wrapper_env=$1; shift
26 logfile=$common_objpfx/posix/globtest.out
28 #CMP=cmp
29 CMP="diff -u"
31 # We have to make the paths `common_objpfx' absolute.
32 case "$common_objpfx" in
33 .*)
34 common_objpfx="`pwd`/$common_objpfx"
38 esac
40 # Since we use `sort' we must make sure to use the same locale everywhere.
41 LC_ALL=C
42 export LC_ALL
44 # Create the arena
45 testdir=${common_objpfx}posix/globtest-dir
46 testout=${common_objpfx}posix/globtest-out
47 rm -rf $testdir $testout
48 mkdir $testdir
50 trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
52 echo 1 > $testdir/file1
53 echo 2 > $testdir/file2
54 echo 3 > $testdir/-file3
55 echo 4 > $testdir/~file4
56 echo 5 > $testdir/.file5
57 echo 6 > $testdir/'*file6'
58 echo 7 > $testdir/'{file7,}'
59 echo 8 > $testdir/'\{file8\}'
60 echo 9 > $testdir/'\{file9\,file9b\}'
61 echo 9 > $testdir/'\file9b\' #'
62 echo a > $testdir/'filea,'
63 echo a > $testdir/'fileb}c'
64 mkdir $testdir/dir1
65 mkdir $testdir/dir2
66 test -d $testdir/noread || mkdir $testdir/noread
67 chmod a-r $testdir/noread
68 echo 1_1 > $testdir/dir1/file1_1
69 echo 1_2 > $testdir/dir1/file1_2
70 ln -fs dir1 $testdir/link1
72 # Run some tests.
73 result=0
74 rm -f $logfile
76 # Normal test
77 failed=0
78 ${test_program_prefix} \
79 ${common_objpfx}posix/globtest "$testdir" "*" |
80 sort > $testout
81 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
82 `*file6'
83 `-file3'
84 `\file9b\'
85 `\{file8\}'
86 `\{file9\,file9b\}'
87 `dir1'
88 `dir2'
89 `file1'
90 `file2'
91 `filea,'
92 `fileb}c'
93 `link1'
94 `noread'
95 `{file7,}'
96 `~file4'
97 EOF
98 if test $failed -ne 0; then
99 echo "Normal test failed" >> $logfile
100 result=1
103 # Don't let glob sort it
104 failed=0
105 ${test_program_prefix} \
106 ${common_objpfx}posix/globtest -s "$testdir" "*" |
107 sort > $testout
108 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
109 `*file6'
110 `-file3'
111 `\file9b\'
112 `\{file8\}'
113 `\{file9\,file9b\}'
114 `dir1'
115 `dir2'
116 `file1'
117 `file2'
118 `filea,'
119 `fileb}c'
120 `link1'
121 `noread'
122 `{file7,}'
123 `~file4'
125 if test $failed -ne 0; then
126 echo "No sort test failed" >> $logfile
127 result=1
130 # Mark directories
131 failed=0
132 ${test_program_prefix} \
133 ${common_objpfx}posix/globtest -m "$testdir" "*" |
134 sort > $testout
135 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
136 `*file6'
137 `-file3'
138 `\file9b\'
139 `\{file8\}'
140 `\{file9\,file9b\}'
141 `dir1/'
142 `dir2/'
143 `file1'
144 `file2'
145 `filea,'
146 `fileb}c'
147 `link1/'
148 `noread/'
149 `{file7,}'
150 `~file4'
152 if test $failed -ne 0; then
153 echo "Mark directories test failed" >> $logfile
154 result=1
157 # Find files starting with .
158 failed=0
159 ${test_program_prefix} \
160 ${common_objpfx}posix/globtest -p "$testdir" "*" |
161 sort > $testout
162 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
163 `*file6'
164 `-file3'
166 `..'
167 `.file5'
168 `\file9b\'
169 `\{file8\}'
170 `\{file9\,file9b\}'
171 `dir1'
172 `dir2'
173 `file1'
174 `file2'
175 `filea,'
176 `fileb}c'
177 `link1'
178 `noread'
179 `{file7,}'
180 `~file4'
182 if test $failed -ne 0; then
183 echo "Leading period test failed" >> $logfile
184 result=1
187 # Test braces
188 failed=0
189 ${test_program_prefix} \
190 ${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
191 sort > $testout
192 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
193 `file1'
194 `file2'
196 if test $failed -ne 0; then
197 echo "Braces test failed" >> $logfile
198 result=1
201 failed=0
202 ${test_program_prefix} \
203 ${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
204 sort > $testout
205 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
206 `-file3'
207 `file1'
208 `file2'
210 if test $failed -ne 0; then
211 echo "Braces test 2 failed" >> $logfile
212 result=1
215 failed=0
216 ${test_program_prefix} \
217 ${common_objpfx}posix/globtest -b "$testdir" "{" |
218 sort > $testout
219 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
220 GLOB_NOMATCH
222 if test $failed -ne 0; then
223 echo "Braces test 3 failed" >> $logfile
224 result=1
227 # Test NOCHECK
228 failed=0
229 ${test_program_prefix} \
230 ${common_objpfx}posix/globtest -c "$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 check test failed" >> $logfile
237 result=1
240 # Test NOMAGIC without magic characters
241 failed=0
242 ${test_program_prefix} \
243 ${common_objpfx}posix/globtest -g "$testdir" "abc" |
244 sort > $testout
245 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
246 `abc'
248 if test $failed -ne 0; then
249 echo "No magic test failed" >> $logfile
250 result=1
253 # Test NOMAGIC with magic characters
254 failed=0
255 ${test_program_prefix} \
256 ${common_objpfx}posix/globtest -g "$testdir" "abc*" |
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 w/ magic chars test failed" >> $logfile
263 result=1
266 # Test NOMAGIC for subdirs
267 failed=0
268 ${test_program_prefix} \
269 ${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
270 sort > $testout
271 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
272 GLOB_NOMATCH
274 if test $failed -ne 0; then
275 echo "No magic in subdir test failed" >> $logfile
276 result=1
279 # Test subdirs correctly
280 failed=0
281 ${test_program_prefix} \
282 ${common_objpfx}posix/globtest "$testdir" "*/*" |
283 sort > $testout
284 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
285 `dir1/file1_1'
286 `dir1/file1_2'
287 `link1/file1_1'
288 `link1/file1_2'
290 if test $failed -ne 0; then
291 echo "Subdirs test failed" >> $logfile
292 result=1
295 # Test subdirs for invalid names
296 failed=0
297 ${test_program_prefix} \
298 ${common_objpfx}posix/globtest "$testdir" "*/1" |
299 sort > $testout
300 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
301 GLOB_NOMATCH
303 if test $failed -ne 0; then
304 echo "Invalid subdir test failed" >> $logfile
305 result=1
308 # Test subdirs with wildcard
309 failed=0
310 ${test_program_prefix} \
311 ${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
312 sort > $testout
313 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
314 `dir1/file1_1'
315 `link1/file1_1'
317 if test $failed -ne 0; then
318 echo "Wildcard subdir test failed" >> $logfile
319 result=1
322 # Test subdirs with ?
323 failed=0
324 ${test_program_prefix} \
325 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
326 sort > $testout
327 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
328 `dir1/file1_1'
329 `dir1/file1_2'
330 `link1/file1_1'
331 `link1/file1_2'
333 if test $failed -ne 0; then
334 echo "Wildcard2 subdir test failed" >> $logfile
335 result=1
338 failed=0
339 ${test_program_prefix} \
340 ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
341 sort > $testout
342 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
343 `dir1/file1_1'
344 `link1/file1_1'
346 if test $failed -ne 0; then
347 echo "Wildcard3 subdir test failed" >> $logfile
348 result=1
351 failed=0
352 ${test_program_prefix} \
353 ${common_objpfx}posix/globtest "$testdir" "*-/*" |
354 sort > $testout
355 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
356 GLOB_NOMATCH
358 if test $failed -ne 0; then
359 echo "Wildcard4 subdir test failed" >> $logfile
360 result=1
363 failed=0
364 ${test_program_prefix} \
365 ${common_objpfx}posix/globtest "$testdir" "*-" |
366 sort > $testout
367 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
368 GLOB_NOMATCH
370 if test $failed -ne 0; then
371 echo "Wildcard5 subdir test failed" >> $logfile
372 result=1
375 # Test subdirs with ?
376 failed=0
377 ${test_program_prefix} \
378 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
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 "Wildcard6 subdir test failed" >> $logfile
388 result=1
391 # Test subdirs with [ .. ]
392 failed=0
393 ${test_program_prefix} \
394 ${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
395 sort > $testout
396 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
397 `dir1/file1_1'
398 `dir1/file1_2'
399 `link1/file1_1'
400 `link1/file1_2'
402 if test $failed -ne 0; then
403 echo "Brackets test failed" >> $logfile
404 result=1
407 # Test ']' inside bracket expression
408 failed=0
409 ${test_program_prefix} \
410 ${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
411 sort > $testout
412 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
413 `dir1/file1_1'
414 `dir1/file1_2'
416 if test $failed -ne 0; then
417 echo "Brackets2 test failed" >> $logfile
418 result=1
421 # Test tilde expansion
422 failed=0
423 ${test_program_prefix} \
424 ${common_objpfx}posix/globtest -q -t "$testdir" "~" |
425 sort >$testout
426 echo ~ | $CMP - $testout >> $logfile || failed=1
427 if test $failed -ne 0; then
428 if test -d ~; then
429 echo "Tilde test failed" >> $logfile
430 result=1
431 else
432 echo "Tilde test could not be run" >> $logfile
436 # Test tilde expansion with trailing slash
437 failed=0
438 ${test_program_prefix} \
439 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
440 sort > $testout
441 # Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
442 if test ~/ = //; then
443 echo / | $CMP - $testout >> $logfile || failed=1
444 else
445 echo ~/ | $CMP - $testout >> $logfile || failed=1
447 if test $failed -ne 0; then
448 if test -d ~/; then
449 echo "Tilde2 test failed" >> $logfile
450 result=1
451 else
452 echo "Tilde2 test could not be run" >> $logfile
456 # Test tilde expansion with username
457 failed=0
458 ${test_program_prefix} \
459 ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
460 sort > $testout
461 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
462 if test $failed -ne 0; then
463 if eval test -d ~$USER; then
464 echo "Tilde3 test failed" >> $logfile
465 result=1
466 else
467 echo "Tilde3 test could not be run" >> $logfile
471 # Tilde expansion shouldn't match a file
472 failed=0
473 ${test_program_prefix} \
474 ${common_objpfx}posix/globtest -T "$testdir" "~file4" |
475 sort > $testout
476 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
477 GLOB_NOMATCH
479 if test $failed -ne 0; then
480 echo "Tilde4 test failed" >> $logfile
481 result=1
484 # Matching \** should only find *file6
485 failed=0
486 ${test_program_prefix} \
487 ${common_objpfx}posix/globtest "$testdir" "\**" |
488 sort > $testout
489 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
490 `*file6'
492 if test $failed -ne 0; then
493 echo "Star test failed" >> $logfile
494 result=1
497 # ... unless NOESCAPE is used, in which case it should entries with a
498 # leading \.
499 failed=0
500 ${test_program_prefix} \
501 ${common_objpfx}posix/globtest -e "$testdir" "\**" |
502 sort > $testout
503 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
504 `\file9b\'
505 `\{file8\}'
506 `\{file9\,file9b\}'
508 if test $failed -ne 0; then
509 echo "Star2 test failed" >> $logfile
510 result=1
513 # Matching \*file6 should find *file6
514 failed=0
515 ${test_program_prefix} \
516 ${common_objpfx}posix/globtest "$testdir" "\*file6" |
517 sort > $testout
518 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
519 `*file6'
521 if test $failed -ne 0; then
522 echo "Star3 test failed" >> $logfile
523 result=1
526 # GLOB_BRACE alone
527 failed=0
528 ${test_program_prefix} \
529 ${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
530 sort > $testout
531 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
532 `{file7,}'
534 if test $failed -ne 0; then
535 echo "Brace4 test failed" >> $logfile
536 result=1
539 # GLOB_BRACE and GLOB_NOESCAPE
540 failed=0
541 ${test_program_prefix} \
542 ${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
543 sort > $testout
544 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
545 `\file9b\'
547 if test $failed -ne 0; then
548 echo "Brace5 test failed" >> $logfile
549 result=1
552 # Escaped comma
553 failed=0
554 ${test_program_prefix} \
555 ${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
556 sort > $testout
557 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
558 `filea,'
560 if test $failed -ne 0; then
561 echo "Brace6 test failed" >> $logfile
562 result=1
565 # Escaped closing brace
566 failed=0
567 ${test_program_prefix} \
568 ${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
569 sort > $testout
570 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
571 `fileb}c'
573 if test $failed -ne 0; then
574 echo "Brace7 test failed" >> $logfile
575 result=1
578 # Try a recursive failed search
579 failed=0
580 ${test_program_prefix} \
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 "Star4 test failed" >> $logfile
588 result=1
591 # ... with GLOB_ERR
592 failed=0
593 ${test_program_prefix} \
594 ${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
595 sort > $testout
596 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
597 GLOB_NOMATCH
599 if test $failed -ne 0; then
600 echo "Star5 test failed" >> $logfile
601 result=1
604 # Try a recursive search in unreadable directory
605 failed=0
606 ${test_program_prefix} \
607 ${common_objpfx}posix/globtest "$testdir" "noread/*" |
608 sort > $testout
609 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
610 GLOB_NOMATCH
612 if test $failed -ne 0; then
613 echo "Star6 test failed" >> $logfile
614 result=1
617 failed=0
618 ${test_program_prefix} \
619 ${common_objpfx}posix/globtest "$testdir" "noread*/*" |
620 sort > $testout
621 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
622 GLOB_NOMATCH
624 if test $failed -ne 0; then
625 echo "Star6 test failed" >> $logfile
626 result=1
629 # The following tests will fail if run as root.
630 user=`id -un 2> /dev/null`
631 if test -z "$user"; then
632 uid="$USER"
634 if test "$user" != root; then
635 # ... with GLOB_ERR
636 ${test_program_prefix} \
637 ${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
638 sort > $testout
639 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
640 GLOB_ABORTED
643 ${test_program_prefix} \
644 ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
645 sort > $testout
646 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
647 GLOB_ABORTED
649 if test $failed -ne 0; then
650 echo "GLOB_ERR test failed" >> $logfile
651 result=1
653 fi # not run as root
655 # Try multiple patterns (GLOB_APPEND)
656 failed=0
657 ${test_program_prefix} \
658 ${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
659 sort > $testout
660 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
661 `dir1/file1_1'
662 `dir1/file1_2'
663 `file1'
664 `link1/file1_1'
665 `link1/file1_2'
667 if test $failed -ne 0; then
668 echo "GLOB_APPEND test failed" >> $logfile
669 result=1
672 # Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
673 failed=0
674 ${test_program_prefix} \
675 ${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
676 sort > $testout
677 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
678 `abc'
679 `dir1/file1_1'
680 `dir1/file1_2'
681 `file1'
682 `link1/file1_1'
683 `link1/file1_2'
685 if test $failed -ne 0; then
686 echo "GLOB_APPEND2 test failed" >> $logfile
687 result=1
690 # Test NOCHECK with non-existing file in subdir.
691 failed=0
692 ${test_program_prefix} \
693 ${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
694 sort > $testout
695 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
696 `*/blahblah'
698 if test $failed -ne 0; then
699 echo "No check2 test failed" >> $logfile
700 result=1
703 # Test [[:punct:]] not matching leading period.
704 failed=0
705 ${test_program_prefix} \
706 ${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
707 sort > $testout
708 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
709 `*file6'
710 `-file3'
711 `\file9b\'
712 `\{file8\}'
713 `\{file9\,file9b\}'
714 `{file7,}'
715 `~file4'
717 if test $failed -ne 0; then
718 echo "Punct test failed" >> $logfile
719 result=1
722 mkdir $testdir/'dir3*'
723 echo 1 > $testdir/'dir3*'/file1
724 mkdir $testdir/'dir4[a'
725 echo 2 > $testdir/'dir4[a'/file1
726 echo 3 > $testdir/'dir4[a'/file2
727 mkdir $testdir/'dir5[ab]'
728 echo 4 > $testdir/'dir5[ab]'/file1
729 echo 5 > $testdir/'dir5[ab]'/file2
730 mkdir $testdir/dir6
731 echo 6 > $testdir/dir6/'file1[a'
732 echo 7 > $testdir/dir6/'file1[ab]'
733 failed=0
734 v=`${test_program_prefix} \
735 ${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
736 test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1
737 ${test_program_prefix} \
738 ${common_objpfx}posix/globtest -c "$testdir" \
739 'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \
740 'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \
741 'dir6/fil*[a' 'dir*6/file1[a' 'dir6/fi*l[ab]' 'dir*6/file1[ab]' \
742 'dir6/file1[[.a.]*' |
743 sort > $testout
744 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
745 `dir*6/file1[ab]'
746 `dir1/file1_1'
747 `dir1/file\1_9'
748 `dir2/'
749 `dir3*/file1'
750 `dir3\*/file2'
751 `dir4[a/file1'
752 `dir4[a/file2'
753 `dir5[ab]/file[12]'
754 `dir6/fi*l[ab]'
755 `dir6/file1[a'
756 `dir6/file1[a'
757 `dir6/file1[a'
758 `dir6/file1[ab]'
759 `nondir\/'
761 ${test_wrapper_env} \
762 HOME="$testdir" \
763 ${test_via_rtld_prefix} \
764 ${common_objpfx}posix/globtest -ct "$testdir" \
765 '~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
766 '~\/dir1/file1_2' |
767 sort > $testout
768 cat <<EOF | $CMP - $testout >> $logfile || failed=1
769 \`$testdir/dir1/file1_1'
770 \`$testdir/dir1/file1_2'
771 \`$testdir/dir3*/file1'
772 \`~/dir1/file1_9'
773 \`~/dir3\\*/file2'
775 if eval test -d ~"$USER"/; then
776 user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'`
777 if test -n "$user"; then
778 ${test_program_prefix} \
779 ${common_objpfx}posix/globtest -ctq "$testdir" "$user/" |
780 sort > $testout
781 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
782 ${test_program_prefix} \
783 ${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" |
784 sort > $testout
785 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
786 ${test_program_prefix} \
787 ${common_objpfx}posix/globtest -ctq "$testdir" "$user" |
788 sort > $testout
789 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
792 if test $failed -ne 0; then
793 echo "Escape tests failed" >> $logfile
794 result=1
797 if test $result -eq 0; then
798 chmod 777 $testdir/noread
799 rm -fr $testdir $testout
800 echo "All OK." > $logfile
803 exit $result
805 # Preserve executable bits for this shell script.
806 Local Variables:
807 eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
808 eval:(make-local-variable 'file-mode)
809 eval:(setq file-mode (file-modes (buffer-file-name)))
810 eval:(make-local-variable 'after-save-hook)
811 eval:(add-hook 'after-save-hook 'frobme)
812 End: