sparc: Check PIC instead of SHARED in start.S [BZ #22638]
[glibc.git] / posix / globtest.sh
blob7f91e810f37a8accbb502c6931e4f15670095044
1 #!/bin/bash
2 # Test for glob(3).
3 # Copyright (C) 1997-2018 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 cleanup() {
51 chmod 777 $testdir/noread
52 rm -fr $testdir $testout
55 trap cleanup 0 HUP INT QUIT TERM
57 echo 1 > $testdir/file1
58 echo 2 > $testdir/file2
59 echo 3 > $testdir/-file3
60 echo 4 > $testdir/~file4
61 echo 5 > $testdir/.file5
62 echo 6 > $testdir/'*file6'
63 echo 7 > $testdir/'{file7,}'
64 echo 8 > $testdir/'\{file8\}'
65 echo 9 > $testdir/'\{file9\,file9b\}'
66 echo 9 > $testdir/'\file9b\' #'
67 echo a > $testdir/'filea,'
68 echo a > $testdir/'fileb}c'
69 mkdir $testdir/dir1
70 mkdir $testdir/dir2
71 test -d $testdir/noread || mkdir $testdir/noread
72 chmod a-r $testdir/noread
73 echo 1_1 > $testdir/dir1/file1_1
74 echo 1_2 > $testdir/dir1/file1_2
75 ln -fs dir1 $testdir/link1
77 # Run some tests.
78 result=0
79 rm -f $logfile
81 # Normal test
82 failed=0
83 ${test_program_prefix} \
84 ${common_objpfx}posix/globtest "$testdir" "*" |
85 sort > $testout
86 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
87 `*file6'
88 `-file3'
89 `\file9b\'
90 `\{file8\}'
91 `\{file9\,file9b\}'
92 `dir1'
93 `dir2'
94 `file1'
95 `file2'
96 `filea,'
97 `fileb}c'
98 `link1'
99 `noread'
100 `{file7,}'
101 `~file4'
103 if test $failed -ne 0; then
104 echo "Normal test failed" >> $logfile
105 result=1
108 # Don't let glob sort it
109 failed=0
110 ${test_program_prefix} \
111 ${common_objpfx}posix/globtest -s "$testdir" "*" |
112 sort > $testout
113 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
114 `*file6'
115 `-file3'
116 `\file9b\'
117 `\{file8\}'
118 `\{file9\,file9b\}'
119 `dir1'
120 `dir2'
121 `file1'
122 `file2'
123 `filea,'
124 `fileb}c'
125 `link1'
126 `noread'
127 `{file7,}'
128 `~file4'
130 if test $failed -ne 0; then
131 echo "No sort test failed" >> $logfile
132 result=1
135 # Mark directories
136 failed=0
137 ${test_program_prefix} \
138 ${common_objpfx}posix/globtest -m "$testdir" "*" |
139 sort > $testout
140 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
141 `*file6'
142 `-file3'
143 `\file9b\'
144 `\{file8\}'
145 `\{file9\,file9b\}'
146 `dir1/'
147 `dir2/'
148 `file1'
149 `file2'
150 `filea,'
151 `fileb}c'
152 `link1/'
153 `noread/'
154 `{file7,}'
155 `~file4'
157 if test $failed -ne 0; then
158 echo "Mark directories test failed" >> $logfile
159 result=1
162 # Find files starting with .
163 failed=0
164 ${test_program_prefix} \
165 ${common_objpfx}posix/globtest -p "$testdir" "*" |
166 sort > $testout
167 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
168 `*file6'
169 `-file3'
171 `..'
172 `.file5'
173 `\file9b\'
174 `\{file8\}'
175 `\{file9\,file9b\}'
176 `dir1'
177 `dir2'
178 `file1'
179 `file2'
180 `filea,'
181 `fileb}c'
182 `link1'
183 `noread'
184 `{file7,}'
185 `~file4'
187 if test $failed -ne 0; then
188 echo "Leading period test failed" >> $logfile
189 result=1
192 # Test braces
193 failed=0
194 ${test_program_prefix} \
195 ${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
196 sort > $testout
197 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
198 `file1'
199 `file2'
201 if test $failed -ne 0; then
202 echo "Braces test failed" >> $logfile
203 result=1
206 failed=0
207 ${test_program_prefix} \
208 ${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
209 sort > $testout
210 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
211 `-file3'
212 `file1'
213 `file2'
215 if test $failed -ne 0; then
216 echo "Braces test 2 failed" >> $logfile
217 result=1
220 failed=0
221 ${test_program_prefix} \
222 ${common_objpfx}posix/globtest -b "$testdir" "{" |
223 sort > $testout
224 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
225 GLOB_NOMATCH
227 if test $failed -ne 0; then
228 echo "Braces test 3 failed" >> $logfile
229 result=1
232 # Test NOCHECK
233 failed=0
234 ${test_program_prefix} \
235 ${common_objpfx}posix/globtest -c "$testdir" "abc" |
236 sort > $testout
237 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
238 `abc'
240 if test $failed -ne 0; then
241 echo "No check test failed" >> $logfile
242 result=1
245 # Test NOMAGIC without magic characters
246 failed=0
247 ${test_program_prefix} \
248 ${common_objpfx}posix/globtest -g "$testdir" "abc" |
249 sort > $testout
250 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
251 `abc'
253 if test $failed -ne 0; then
254 echo "No magic test failed" >> $logfile
255 result=1
258 # Test NOMAGIC with magic characters
259 failed=0
260 ${test_program_prefix} \
261 ${common_objpfx}posix/globtest -g "$testdir" "abc*" |
262 sort > $testout
263 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
264 GLOB_NOMATCH
266 if test $failed -ne 0; then
267 echo "No magic w/ magic chars test failed" >> $logfile
268 result=1
271 # Test NOMAGIC for subdirs
272 failed=0
273 ${test_program_prefix} \
274 ${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
275 sort > $testout
276 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
277 GLOB_NOMATCH
279 if test $failed -ne 0; then
280 echo "No magic in subdir test failed" >> $logfile
281 result=1
284 # Test subdirs correctly
285 failed=0
286 ${test_program_prefix} \
287 ${common_objpfx}posix/globtest "$testdir" "*/*" |
288 sort > $testout
289 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
290 `dir1/file1_1'
291 `dir1/file1_2'
292 `link1/file1_1'
293 `link1/file1_2'
295 if test $failed -ne 0; then
296 echo "Subdirs test failed" >> $logfile
297 result=1
300 # Test subdirs for invalid names
301 failed=0
302 ${test_program_prefix} \
303 ${common_objpfx}posix/globtest "$testdir" "*/1" |
304 sort > $testout
305 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
306 GLOB_NOMATCH
308 if test $failed -ne 0; then
309 echo "Invalid subdir test failed" >> $logfile
310 result=1
313 # Test subdirs with wildcard
314 failed=0
315 ${test_program_prefix} \
316 ${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
317 sort > $testout
318 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
319 `dir1/file1_1'
320 `link1/file1_1'
322 if test $failed -ne 0; then
323 echo "Wildcard subdir test failed" >> $logfile
324 result=1
327 # Test subdirs with ?
328 failed=0
329 ${test_program_prefix} \
330 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
331 sort > $testout
332 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
333 `dir1/file1_1'
334 `dir1/file1_2'
335 `link1/file1_1'
336 `link1/file1_2'
338 if test $failed -ne 0; then
339 echo "Wildcard2 subdir test failed" >> $logfile
340 result=1
343 failed=0
344 ${test_program_prefix} \
345 ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
346 sort > $testout
347 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
348 `dir1/file1_1'
349 `link1/file1_1'
351 if test $failed -ne 0; then
352 echo "Wildcard3 subdir test failed" >> $logfile
353 result=1
356 failed=0
357 ${test_program_prefix} \
358 ${common_objpfx}posix/globtest "$testdir" "*-/*" |
359 sort > $testout
360 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
361 GLOB_NOMATCH
363 if test $failed -ne 0; then
364 echo "Wildcard4 subdir test failed" >> $logfile
365 result=1
368 failed=0
369 ${test_program_prefix} \
370 ${common_objpfx}posix/globtest "$testdir" "*-" |
371 sort > $testout
372 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
373 GLOB_NOMATCH
375 if test $failed -ne 0; then
376 echo "Wildcard5 subdir test failed" >> $logfile
377 result=1
380 # Test subdirs with ?
381 failed=0
382 ${test_program_prefix} \
383 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
384 sort > $testout
385 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
386 `dir1/file1_1'
387 `dir1/file1_2'
388 `link1/file1_1'
389 `link1/file1_2'
391 if test $failed -ne 0; then
392 echo "Wildcard6 subdir test failed" >> $logfile
393 result=1
396 # Test subdirs with [ .. ]
397 failed=0
398 ${test_program_prefix} \
399 ${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
400 sort > $testout
401 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
402 `dir1/file1_1'
403 `dir1/file1_2'
404 `link1/file1_1'
405 `link1/file1_2'
407 if test $failed -ne 0; then
408 echo "Brackets test failed" >> $logfile
409 result=1
412 # Test ']' inside bracket expression
413 failed=0
414 ${test_program_prefix} \
415 ${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
416 sort > $testout
417 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
418 `dir1/file1_1'
419 `dir1/file1_2'
421 if test $failed -ne 0; then
422 echo "Brackets2 test failed" >> $logfile
423 result=1
426 # Test tilde expansion
427 failed=0
428 ${test_program_prefix} \
429 ${common_objpfx}posix/globtest -q -t "$testdir" "~" |
430 sort >$testout
431 echo ~ | $CMP - $testout >> $logfile || failed=1
432 if test $failed -ne 0; then
433 if test -d ~; then
434 echo "Tilde test failed" >> $logfile
435 result=1
436 else
437 echo "Tilde test could not be run" >> $logfile
441 # Test tilde expansion with trailing slash
442 failed=0
443 ${test_program_prefix} \
444 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
445 sort > $testout
446 # Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
447 if test ~/ = //; then
448 echo / | $CMP - $testout >> $logfile || failed=1
449 else
450 echo ~/ | $CMP - $testout >> $logfile || failed=1
452 if test $failed -ne 0; then
453 if test -d ~/; then
454 echo "Tilde2 test failed" >> $logfile
455 result=1
456 else
457 echo "Tilde2 test could not be run" >> $logfile
461 # Test tilde expansion with username
462 failed=0
463 ${test_program_prefix} \
464 ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
465 sort > $testout
466 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
467 if test $failed -ne 0; then
468 if eval test -d ~$USER; then
469 echo "Tilde3 test failed" >> $logfile
470 result=1
471 else
472 echo "Tilde3 test could not be run" >> $logfile
476 # Tilde expansion shouldn't match a file
477 failed=0
478 ${test_program_prefix} \
479 ${common_objpfx}posix/globtest -T "$testdir" "~file4" |
480 sort > $testout
481 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
482 GLOB_NOMATCH
484 if test $failed -ne 0; then
485 echo "Tilde4 test failed" >> $logfile
486 result=1
489 # Matching \** should only find *file6
490 failed=0
491 ${test_program_prefix} \
492 ${common_objpfx}posix/globtest "$testdir" "\**" |
493 sort > $testout
494 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
495 `*file6'
497 if test $failed -ne 0; then
498 echo "Star test failed" >> $logfile
499 result=1
502 # ... unless NOESCAPE is used, in which case it should entries with a
503 # leading \.
504 failed=0
505 ${test_program_prefix} \
506 ${common_objpfx}posix/globtest -e "$testdir" "\**" |
507 sort > $testout
508 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
509 `\file9b\'
510 `\{file8\}'
511 `\{file9\,file9b\}'
513 if test $failed -ne 0; then
514 echo "Star2 test failed" >> $logfile
515 result=1
518 # Matching \*file6 should find *file6
519 failed=0
520 ${test_program_prefix} \
521 ${common_objpfx}posix/globtest "$testdir" "\*file6" |
522 sort > $testout
523 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
524 `*file6'
526 if test $failed -ne 0; then
527 echo "Star3 test failed" >> $logfile
528 result=1
531 # GLOB_BRACE alone
532 failed=0
533 ${test_program_prefix} \
534 ${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
535 sort > $testout
536 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
537 `{file7,}'
539 if test $failed -ne 0; then
540 echo "Brace4 test failed" >> $logfile
541 result=1
544 # GLOB_BRACE and GLOB_NOESCAPE
545 failed=0
546 ${test_program_prefix} \
547 ${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
548 sort > $testout
549 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
550 `\file9b\'
552 if test $failed -ne 0; then
553 echo "Brace5 test failed" >> $logfile
554 result=1
557 # Escaped comma
558 failed=0
559 ${test_program_prefix} \
560 ${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
561 sort > $testout
562 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
563 `filea,'
565 if test $failed -ne 0; then
566 echo "Brace6 test failed" >> $logfile
567 result=1
570 # Escaped closing brace
571 failed=0
572 ${test_program_prefix} \
573 ${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
574 sort > $testout
575 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
576 `fileb}c'
578 if test $failed -ne 0; then
579 echo "Brace7 test failed" >> $logfile
580 result=1
583 # Try a recursive failed search
584 failed=0
585 ${test_program_prefix} \
586 ${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
587 sort > $testout
588 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
589 GLOB_NOMATCH
591 if test $failed -ne 0; then
592 echo "Star4 test failed" >> $logfile
593 result=1
596 # ... with GLOB_ERR
597 failed=0
598 ${test_program_prefix} \
599 ${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
600 sort > $testout
601 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
602 GLOB_NOMATCH
604 if test $failed -ne 0; then
605 echo "Star5 test failed" >> $logfile
606 result=1
609 # Try a recursive search in unreadable directory
610 failed=0
611 ${test_program_prefix} \
612 ${common_objpfx}posix/globtest "$testdir" "noread/*" |
613 sort > $testout
614 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
615 GLOB_NOMATCH
617 if test $failed -ne 0; then
618 echo "Star6 test failed" >> $logfile
619 result=1
622 failed=0
623 ${test_program_prefix} \
624 ${common_objpfx}posix/globtest "$testdir" "noread*/*" |
625 sort > $testout
626 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
627 GLOB_NOMATCH
629 if test $failed -ne 0; then
630 echo "Star6 test failed" >> $logfile
631 result=1
634 # The following tests will fail if run as root.
635 user=`id -un 2> /dev/null`
636 if test -z "$user"; then
637 uid="$USER"
639 if test "$user" != root; then
640 # ... with GLOB_ERR
641 ${test_program_prefix} \
642 ${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
643 sort > $testout
644 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
645 GLOB_ABORTED
648 ${test_program_prefix} \
649 ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
650 sort > $testout
651 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
652 GLOB_ABORTED
654 if test $failed -ne 0; then
655 echo "GLOB_ERR test failed" >> $logfile
656 result=1
658 fi # not run as root
660 # Try multiple patterns (GLOB_APPEND)
661 failed=0
662 ${test_program_prefix} \
663 ${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
664 sort > $testout
665 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
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_APPEND test failed" >> $logfile
674 result=1
677 # Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
678 failed=0
679 ${test_program_prefix} \
680 ${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
681 sort > $testout
682 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
683 `abc'
684 `dir1/file1_1'
685 `dir1/file1_2'
686 `file1'
687 `link1/file1_1'
688 `link1/file1_2'
690 if test $failed -ne 0; then
691 echo "GLOB_APPEND2 test failed" >> $logfile
692 result=1
695 # Test NOCHECK with non-existing file in subdir.
696 failed=0
697 ${test_program_prefix} \
698 ${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
699 sort > $testout
700 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
701 `*/blahblah'
703 if test $failed -ne 0; then
704 echo "No check2 test failed" >> $logfile
705 result=1
708 # Test [[:punct:]] not matching leading period.
709 failed=0
710 ${test_program_prefix} \
711 ${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
712 sort > $testout
713 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
714 `*file6'
715 `-file3'
716 `\file9b\'
717 `\{file8\}'
718 `\{file9\,file9b\}'
719 `{file7,}'
720 `~file4'
722 if test $failed -ne 0; then
723 echo "Punct test failed" >> $logfile
724 result=1
727 mkdir $testdir/'dir3*'
728 echo 1 > $testdir/'dir3*'/file1
729 mkdir $testdir/'dir4[a'
730 echo 2 > $testdir/'dir4[a'/file1
731 echo 3 > $testdir/'dir4[a'/file2
732 mkdir $testdir/'dir5[ab]'
733 echo 4 > $testdir/'dir5[ab]'/file1
734 echo 5 > $testdir/'dir5[ab]'/file2
735 mkdir $testdir/dir6
736 echo 6 > $testdir/dir6/'file1[a'
737 echo 7 > $testdir/dir6/'file1[ab]'
738 failed=0
739 v=`${test_program_prefix} \
740 ${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
741 test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1
742 ${test_program_prefix} \
743 ${common_objpfx}posix/globtest -c "$testdir" \
744 'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \
745 'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \
746 'dir6/fil*[a' 'dir*6/file1[a' 'dir6/fi*l[ab]' 'dir*6/file1[ab]' \
747 'dir6/file1[[.a.]*' |
748 sort > $testout
749 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
750 `dir*6/file1[ab]'
751 `dir1/file1_1'
752 `dir1/file\1_9'
753 `dir2/'
754 `dir3*/file1'
755 `dir3\*/file2'
756 `dir4[a/file1'
757 `dir4[a/file2'
758 `dir5[ab]/file[12]'
759 `dir6/fi*l[ab]'
760 `dir6/file1[a'
761 `dir6/file1[a'
762 `dir6/file1[a'
763 `dir6/file1[ab]'
764 `nondir\/'
766 ${test_wrapper_env} \
767 HOME="$testdir" \
768 ${test_via_rtld_prefix} \
769 ${common_objpfx}posix/globtest -ct "$testdir" \
770 '~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
771 '~\/dir1/file1_2' |
772 sort > $testout
773 cat <<EOF | $CMP - $testout >> $logfile || failed=1
774 \`$testdir/dir1/file1_1'
775 \`$testdir/dir1/file1_2'
776 \`$testdir/dir3*/file1'
777 \`~/dir1/file1_9'
778 \`~/dir3\\*/file2'
780 if eval test -d ~"$USER"/; then
781 user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'`
782 if test -n "$user"; then
783 ${test_program_prefix} \
784 ${common_objpfx}posix/globtest -ctq "$testdir" "$user/" |
785 sort > $testout
786 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
787 ${test_program_prefix} \
788 ${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" |
789 sort > $testout
790 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
791 ${test_program_prefix} \
792 ${common_objpfx}posix/globtest -ctq "$testdir" "$user" |
793 sort > $testout
794 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
797 if test $failed -ne 0; then
798 echo "Escape tests failed" >> $logfile
799 result=1
802 # Test GLOB_BRACE and GLIB_DOOFFS with malloc checking
803 failed=0
804 ${test_wrapper_env} \
805 MALLOC_PERTURB_=65 \
806 ${test_via_rtld_prefix} \
807 ${common_objpfx}posix/globtest -b -o "$testdir" "file{1,2}" > $testout || failed=1
808 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
809 `abc'
810 `file1'
811 `file2'
813 if test $failed -ne 0; then
814 echo "GLOB_BRACE+GLOB_DOOFFS test failed" >> $logfile
815 result=1
818 if test $result -eq 0; then
819 echo "All OK." > $logfile
822 exit $result
824 # Preserve executable bits for this shell script.
825 Local Variables:
826 eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
827 eval:(make-local-variable 'file-mode)
828 eval:(setq file-mode (file-modes (buffer-file-name)))
829 eval:(make-local-variable 'after-save-hook)
830 eval:(add-hook 'after-save-hook 'frobme)
831 End: