blob: 73fe11bd76dbea1c170e22c294276b61e687f918 [file] [log] [blame]
xf.libdd93d52023-05-12 07:10:14 -07001#!/bin/bash
2# Test for glob(3).
3# Copyright (C) 1997-2016 Free Software Foundation, Inc.
4# This file is part of the GNU C Library.
5
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.
10
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.
15
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/>.
19
20set -e
21
22common_objpfx=$1; shift
23test_via_rtld_prefix=$1; shift
24test_program_prefix=$1; shift
25test_wrapper_env=$1; shift
26logfile=$common_objpfx/posix/globtest.out
27
28#CMP=cmp
29CMP="diff -u"
30
31# We have to make the paths `common_objpfx' absolute.
32case "$common_objpfx" in
33 .*)
34 common_objpfx="`pwd`/$common_objpfx"
35 ;;
36 *)
37 ;;
38esac
39
40# Since we use `sort' we must make sure to use the same locale everywhere.
41LC_ALL=C
42export LC_ALL
43
44# Create the arena
45testdir=${common_objpfx}posix/globtest-dir
46testout=${common_objpfx}posix/globtest-out
47rm -rf $testdir $testout
48mkdir $testdir
49
50trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
51
52echo 1 > $testdir/file1
53echo 2 > $testdir/file2
54echo 3 > $testdir/-file3
55echo 4 > $testdir/~file4
56echo 5 > $testdir/.file5
57echo 6 > $testdir/'*file6'
58echo 7 > $testdir/'{file7,}'
59echo 8 > $testdir/'\{file8\}'
60echo 9 > $testdir/'\{file9\,file9b\}'
61echo 9 > $testdir/'\file9b\' #'
62echo a > $testdir/'filea,'
63echo a > $testdir/'fileb}c'
64mkdir $testdir/dir1
65mkdir $testdir/dir2
66test -d $testdir/noread || mkdir $testdir/noread
67chmod a-r $testdir/noread
68echo 1_1 > $testdir/dir1/file1_1
69echo 1_2 > $testdir/dir1/file1_2
70ln -fs dir1 $testdir/link1
71
72# Run some tests.
73result=0
74rm -f $logfile
75
76# Normal test
77failed=0
78${test_program_prefix} \
79${common_objpfx}posix/globtest "$testdir" "*" |
80sort > $testout
81cat <<"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'
97EOF
98if test $failed -ne 0; then
99 echo "Normal test failed" >> $logfile
100 result=1
101fi
102
103# Don't let glob sort it
104failed=0
105${test_program_prefix} \
106${common_objpfx}posix/globtest -s "$testdir" "*" |
107sort > $testout
108cat <<"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'
124EOF
125if test $failed -ne 0; then
126 echo "No sort test failed" >> $logfile
127 result=1
128fi
129
130# Mark directories
131failed=0
132${test_program_prefix} \
133${common_objpfx}posix/globtest -m "$testdir" "*" |
134sort > $testout
135cat <<"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'
151EOF
152if test $failed -ne 0; then
153 echo "Mark directories test failed" >> $logfile
154 result=1
155fi
156
157# Find files starting with .
158failed=0
159${test_program_prefix} \
160${common_objpfx}posix/globtest -p "$testdir" "*" |
161sort > $testout
162cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
163`*file6'
164`-file3'
165`.'
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'
181EOF
182if test $failed -ne 0; then
183 echo "Leading period test failed" >> $logfile
184 result=1
185fi
186
187# Test braces
188failed=0
189${test_program_prefix} \
190${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
191sort > $testout
192cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
193`file1'
194`file2'
195EOF
196if test $failed -ne 0; then
197 echo "Braces test failed" >> $logfile
198 result=1
199fi
200
201failed=0
202${test_program_prefix} \
203${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
204sort > $testout
205cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
206`-file3'
207`file1'
208`file2'
209EOF
210if test $failed -ne 0; then
211 echo "Braces test 2 failed" >> $logfile
212 result=1
213fi
214
215failed=0
216${test_program_prefix} \
217${common_objpfx}posix/globtest -b "$testdir" "{" |
218sort > $testout
219cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
220GLOB_NOMATCH
221EOF
222if test $failed -ne 0; then
223 echo "Braces test 3 failed" >> $logfile
224 result=1
225fi
226
227# Test NOCHECK
228failed=0
229${test_program_prefix} \
230${common_objpfx}posix/globtest -c "$testdir" "abc" |
231sort > $testout
232cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
233`abc'
234EOF
235if test $failed -ne 0; then
236 echo "No check test failed" >> $logfile
237 result=1
238fi
239
240# Test NOMAGIC without magic characters
241failed=0
242${test_program_prefix} \
243${common_objpfx}posix/globtest -g "$testdir" "abc" |
244sort > $testout
245cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
246`abc'
247EOF
248if test $failed -ne 0; then
249 echo "No magic test failed" >> $logfile
250 result=1
251fi
252
253# Test NOMAGIC with magic characters
254failed=0
255${test_program_prefix} \
256${common_objpfx}posix/globtest -g "$testdir" "abc*" |
257sort > $testout
258cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
259GLOB_NOMATCH
260EOF
261if test $failed -ne 0; then
262 echo "No magic w/ magic chars test failed" >> $logfile
263 result=1
264fi
265
266# Test NOMAGIC for subdirs
267failed=0
268${test_program_prefix} \
269${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
270sort > $testout
271cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
272GLOB_NOMATCH
273EOF
274if test $failed -ne 0; then
275 echo "No magic in subdir test failed" >> $logfile
276 result=1
277fi
278
279# Test subdirs correctly
280failed=0
281${test_program_prefix} \
282${common_objpfx}posix/globtest "$testdir" "*/*" |
283sort > $testout
284cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
285`dir1/file1_1'
286`dir1/file1_2'
287`link1/file1_1'
288`link1/file1_2'
289EOF
290if test $failed -ne 0; then
291 echo "Subdirs test failed" >> $logfile
292 result=1
293fi
294
295# Test subdirs for invalid names
296failed=0
297${test_program_prefix} \
298${common_objpfx}posix/globtest "$testdir" "*/1" |
299sort > $testout
300cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
301GLOB_NOMATCH
302EOF
303if test $failed -ne 0; then
304 echo "Invalid subdir test failed" >> $logfile
305 result=1
306fi
307
308# Test subdirs with wildcard
309failed=0
310${test_program_prefix} \
311${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
312sort > $testout
313cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
314`dir1/file1_1'
315`link1/file1_1'
316EOF
317if test $failed -ne 0; then
318 echo "Wildcard subdir test failed" >> $logfile
319 result=1
320fi
321
322# Test subdirs with ?
323failed=0
324${test_program_prefix} \
325${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
326sort > $testout
327cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
328`dir1/file1_1'
329`dir1/file1_2'
330`link1/file1_1'
331`link1/file1_2'
332EOF
333if test $failed -ne 0; then
334 echo "Wildcard2 subdir test failed" >> $logfile
335 result=1
336fi
337
338failed=0
339${test_program_prefix} \
340${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
341sort > $testout
342cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
343`dir1/file1_1'
344`link1/file1_1'
345EOF
346if test $failed -ne 0; then
347 echo "Wildcard3 subdir test failed" >> $logfile
348 result=1
349fi
350
351failed=0
352${test_program_prefix} \
353${common_objpfx}posix/globtest "$testdir" "*-/*" |
354sort > $testout
355cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
356GLOB_NOMATCH
357EOF
358if test $failed -ne 0; then
359 echo "Wildcard4 subdir test failed" >> $logfile
360 result=1
361fi
362
363failed=0
364${test_program_prefix} \
365${common_objpfx}posix/globtest "$testdir" "*-" |
366sort > $testout
367cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
368GLOB_NOMATCH
369EOF
370if test $failed -ne 0; then
371 echo "Wildcard5 subdir test failed" >> $logfile
372 result=1
373fi
374
375# Test subdirs with ?
376failed=0
377${test_program_prefix} \
378${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
379sort > $testout
380cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
381`dir1/file1_1'
382`dir1/file1_2'
383`link1/file1_1'
384`link1/file1_2'
385EOF
386if test $failed -ne 0; then
387 echo "Wildcard6 subdir test failed" >> $logfile
388 result=1
389fi
390
391# Test subdirs with [ .. ]
392failed=0
393${test_program_prefix} \
394${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
395sort > $testout
396cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
397`dir1/file1_1'
398`dir1/file1_2'
399`link1/file1_1'
400`link1/file1_2'
401EOF
402if test $failed -ne 0; then
403 echo "Brackets test failed" >> $logfile
404 result=1
405fi
406
407# Test ']' inside bracket expression
408failed=0
409${test_program_prefix} \
410${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
411sort > $testout
412cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
413`dir1/file1_1'
414`dir1/file1_2'
415EOF
416if test $failed -ne 0; then
417 echo "Brackets2 test failed" >> $logfile
418 result=1
419fi
420
421# Test tilde expansion
422failed=0
423${test_program_prefix} \
424${common_objpfx}posix/globtest -q -t "$testdir" "~" |
425sort >$testout
426echo ~ | $CMP - $testout >> $logfile || failed=1
427if 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
433 fi
434fi
435
436# Test tilde expansion with trailing slash
437failed=0
438${test_program_prefix} \
439${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
440sort > $testout
441# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
442if test ~/ = //; then
443 echo / | $CMP - $testout >> $logfile || failed=1
444else
445 echo ~/ | $CMP - $testout >> $logfile || failed=1
446fi
447if 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
453 fi
454fi
455
456# Test tilde expansion with username
457failed=0
458${test_program_prefix} \
459${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
460sort > $testout
461eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
462if 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
468 fi
469fi
470
471# Tilde expansion shouldn't match a file
472failed=0
473${test_program_prefix} \
474${common_objpfx}posix/globtest -T "$testdir" "~file4" |
475sort > $testout
476cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
477GLOB_NOMATCH
478EOF
479if test $failed -ne 0; then
480 echo "Tilde4 test failed" >> $logfile
481 result=1
482fi
483
484# Matching \** should only find *file6
485failed=0
486${test_program_prefix} \
487${common_objpfx}posix/globtest "$testdir" "\**" |
488sort > $testout
489cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
490`*file6'
491EOF
492if test $failed -ne 0; then
493 echo "Star test failed" >> $logfile
494 result=1
495fi
496
497# ... unless NOESCAPE is used, in which case it should entries with a
498# leading \.
499failed=0
500${test_program_prefix} \
501${common_objpfx}posix/globtest -e "$testdir" "\**" |
502sort > $testout
503cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
504`\file9b\'
505`\{file8\}'
506`\{file9\,file9b\}'
507EOF
508if test $failed -ne 0; then
509 echo "Star2 test failed" >> $logfile
510 result=1
511fi
512
513# Matching \*file6 should find *file6
514failed=0
515${test_program_prefix} \
516${common_objpfx}posix/globtest "$testdir" "\*file6" |
517sort > $testout
518cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
519`*file6'
520EOF
521if test $failed -ne 0; then
522 echo "Star3 test failed" >> $logfile
523 result=1
524fi
525
526# GLOB_BRACE alone
527failed=0
528${test_program_prefix} \
529${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
530sort > $testout
531cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
532`{file7,}'
533EOF
534if test $failed -ne 0; then
535 echo "Brace4 test failed" >> $logfile
536 result=1
537fi
538
539# GLOB_BRACE and GLOB_NOESCAPE
540failed=0
541${test_program_prefix} \
542${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
543sort > $testout
544cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
545`\file9b\'
546EOF
547if test $failed -ne 0; then
548 echo "Brace5 test failed" >> $logfile
549 result=1
550fi
551
552# Escaped comma
553failed=0
554${test_program_prefix} \
555${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
556sort > $testout
557cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
558`filea,'
559EOF
560if test $failed -ne 0; then
561 echo "Brace6 test failed" >> $logfile
562 result=1
563fi
564
565# Escaped closing brace
566failed=0
567${test_program_prefix} \
568${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
569sort > $testout
570cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
571`fileb}c'
572EOF
573if test $failed -ne 0; then
574 echo "Brace7 test failed" >> $logfile
575 result=1
576fi
577
578# Try a recursive failed search
579failed=0
580${test_program_prefix} \
581${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
582sort > $testout
583cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
584GLOB_NOMATCH
585EOF
586if test $failed -ne 0; then
587 echo "Star4 test failed" >> $logfile
588 result=1
589fi
590
591# ... with GLOB_ERR
592failed=0
593${test_program_prefix} \
594${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
595sort > $testout
596cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
597GLOB_NOMATCH
598EOF
599if test $failed -ne 0; then
600 echo "Star5 test failed" >> $logfile
601 result=1
602fi
603
604# Try a recursive search in unreadable directory
605failed=0
606${test_program_prefix} \
607${common_objpfx}posix/globtest "$testdir" "noread/*" |
608sort > $testout
609cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
610GLOB_NOMATCH
611EOF
612if test $failed -ne 0; then
613 echo "Star6 test failed" >> $logfile
614 result=1
615fi
616
617failed=0
618${test_program_prefix} \
619${common_objpfx}posix/globtest "$testdir" "noread*/*" |
620sort > $testout
621cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
622GLOB_NOMATCH
623EOF
624if test $failed -ne 0; then
625 echo "Star6 test failed" >> $logfile
626 result=1
627fi
628
629# The following tests will fail if run as root.
630user=`id -un 2> /dev/null`
631if test -z "$user"; then
632 uid="$USER"
633fi
634if 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
640GLOB_ABORTED
641EOF
642
643 ${test_program_prefix} \
644 ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
645 sort > $testout
646 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
647GLOB_ABORTED
648EOF
649if test $failed -ne 0; then
650 echo "GLOB_ERR test failed" >> $logfile
651 result=1
652fi
653fi # not run as root
654
655# Try multiple patterns (GLOB_APPEND)
656failed=0
657${test_program_prefix} \
658${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
659sort > $testout
660cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
661`dir1/file1_1'
662`dir1/file1_2'
663`file1'
664`link1/file1_1'
665`link1/file1_2'
666EOF
667if test $failed -ne 0; then
668 echo "GLOB_APPEND test failed" >> $logfile
669 result=1
670fi
671
672# Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
673failed=0
674${test_program_prefix} \
675${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
676sort > $testout
677cat <<"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'
684EOF
685if test $failed -ne 0; then
686 echo "GLOB_APPEND2 test failed" >> $logfile
687 result=1
688fi
689
690# Test NOCHECK with non-existing file in subdir.
691failed=0
692${test_program_prefix} \
693${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
694sort > $testout
695cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
696`*/blahblah'
697EOF
698if test $failed -ne 0; then
699 echo "No check2 test failed" >> $logfile
700 result=1
701fi
702
703# Test [[:punct:]] not matching leading period.
704failed=0
705${test_program_prefix} \
706${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
707sort > $testout
708cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
709`*file6'
710`-file3'
711`\file9b\'
712`\{file8\}'
713`\{file9\,file9b\}'
714`{file7,}'
715`~file4'
716EOF
717if test $failed -ne 0; then
718 echo "Punct test failed" >> $logfile
719 result=1
720fi
721
722mkdir $testdir/'dir3*'
723echo 1 > $testdir/'dir3*'/file1
724mkdir $testdir/'dir4[a'
725echo 2 > $testdir/'dir4[a'/file1
726echo 3 > $testdir/'dir4[a'/file2
727mkdir $testdir/'dir5[ab]'
728echo 4 > $testdir/'dir5[ab]'/file1
729echo 5 > $testdir/'dir5[ab]'/file2
730mkdir $testdir/dir6
731echo 6 > $testdir/dir6/'file1[a'
732echo 7 > $testdir/dir6/'file1[ab]'
733failed=0
734v=`${test_program_prefix} \
735 ${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
736test "$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.]*' |
743sort > $testout
744cat <<"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\/'
760EOF
761${test_wrapper_env} \
762HOME="$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' |
767sort > $testout
768cat <<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'
774EOF
775if 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
790 fi
791fi
792if test $failed -ne 0; then
793 echo "Escape tests failed" >> $logfile
794 result=1
795fi
796
797if test $result -eq 0; then
798 chmod 777 $testdir/noread
799 rm -fr $testdir $testout
800 echo "All OK." > $logfile
801fi
802
803exit $result
804
805# Preserve executable bits for this shell script.
806Local Variables:
807eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
808eval:(make-local-variable 'file-mode)
809eval:(setq file-mode (file-modes (buffer-file-name)))
810eval:(make-local-variable 'after-save-hook)
811eval:(add-hook 'after-save-hook 'frobme)
812End: