Update.
[glibc.git] / posix / globtest.sh
blob48328af032ac3684a7573adb38efed1cac1065b6
1 #! /bin/sh
3 common_objpfx=$1; shift
4 elf_objpfx=$1; shift
5 rtld_installed_name=$1; shift
7 # Create the arena
8 : ${TMPDIR=/tmp}
9 testdir=$TMPDIR/globtest-dir
10 testout=$TMPDIR/globtest-out
12 trap 'rm -fr $testdir $testout' 1 2 3 15
14 rm -fr $testdir
15 mkdir $testdir
16 echo 1 > $testdir/file1
17 echo 2 > $testdir/file2
18 mkdir $testdir/dir1
19 mkdir $testdir/dir2
20 echo 1_1 > $testdir/dir1/file1_1
21 echo 1_2 > $testdir/dir1/file1_2
23 # Run some tests.
24 result=0
26 LD_LIBRARY_PATH=$common_objpfx \
27 ${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*" |
28 sort > $testout
29 cat <<"EOF" | cmp - $testout || result=1
30 `dir1'
31 `dir2'
32 `file1'
33 `file2'
34 not NULL
35 EOF
37 LD_LIBRARY_PATH=$common_objpfx \
38 ${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/*" |
39 sort > $testout
40 cat <<"EOF" | cmp - $testout || result=1
41 `dir1/file1_1'
42 `dir1/file1_2'
43 not NULL
44 EOF
46 LD_LIBRARY_PATH=$common_objpfx \
47 ${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/1" |
48 sort > $testout
49 cat <<"EOF" | cmp - $testout || result=1
50 GLOB_NOMATCH
51 NULL
52 EOF
54 LD_LIBRARY_PATH=$common_objpfx \
55 ${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
56 sort > $testout
57 cat <<"EOF" | cmp - $testout || result=1
58 `dir1/file1_1'
59 not NULL
60 EOF
62 LD_LIBRARY_PATH=$common_objpfx \
63 ${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
64 sort > $testout
65 cat <<"EOF" | cmp - $testout || result=1
66 `dir1/file1_1'
67 not NULL
68 EOF
70 LD_LIBRARY_PATH=$common_objpfx \
71 ${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*-/*" |
72 sort > $testout
73 cat <<"EOF" | cmp - $testout || result=1
74 GLOB_NOMATCH
75 NULL
76 EOF
78 LD_LIBRARY_PATH=$common_objpfx \
79 ${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*-" |
80 sort > $testout
81 cat <<"EOF" | cmp - $testout || result=1
82 GLOB_NOMATCH
83 NULL
84 EOF
86 if test $result -eq 0; then
87 rm -fr $testdir $testout
90 exit $result
92 # Preserve executable bits for this shell script.
93 Local Variables:
94 eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
95 eval:(make-local-variable 'file-mode)
96 eval:(setq file-mode (file-modes (buffer-file-name)))
97 eval:(make-local-variable 'after-save-hook)
98 eval:(add-hook 'after-save-hook 'frobme)
99 End: