3 common_objpfx
=$1; shift
5 rtld_installed_name
=$1; shift
7 # We have to find the libc and the NSS modules.
8 library_path
=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis
10 # Since we use `osrt' we must make sure to use the same locale everywhere.
18 testdir
=$TMPDIR/globtest-dir
19 testout
=$TMPDIR/globtest-out
20 testout2
=$TMPDIR/globtest-out2
22 trap 'rm -fr $testdir $testout $testout2' 1 2 3 15
26 echo 1 > $testdir/file1
27 echo 2 > $testdir/file2
28 echo 3 > $testdir/-file3
29 echo 4 > $testdir/~file4
30 echo 5 > $testdir/.file5
31 echo 6 > $testdir/'*file6'
34 echo 1_1
> $testdir/dir
1/file1_1
35 echo 1_2
> $testdir/dir
1/file1_2
41 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
42 ${common_objpfx}posix
/globtest
"$testdir" "*" |
44 cat <<"EOF" | cmp - $testout || result=1
54 # Don't let glob sort it
55 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
56 ${common_objpfx}posix/globtest -s "$testdir" "*" |
58 cat <<"EOF" |
cmp - $testout || result
=1
69 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
70 ${common_objpfx}posix/globtest -m "$testdir" "*" |
72 cat <<"EOF" | cmp - $testout || result=1
82 # Find files starting with .
83 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
84 ${common_objpfx}posix/globtest -p "$testdir" "*" |
86 cat <<"EOF" | cmp - $testout || result=1
100 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
101 ${common_objpfx}posix
/globtest
-b "$testdir" "file{1,2}" |
103 cat <<"EOF" | cmp - $testout || result=1
109 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
110 ${common_objpfx}posix/globtest -c "$testdir" "abc" |
112 cat <<"EOF" |
cmp - $testout || result
=1
116 # Test NOMAGIC without magic characters
117 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
118 ${common_objpfx}posix/globtest -g "$testdir" "abc" |
120 cat <<"EOF" | cmp - $testout || result=1
124 # Test NOMAGIC with magic characters
125 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
126 ${common_objpfx}posix/globtest -g "$testdir" "abc*" |
128 cat <<"EOF" | cmp - $testout || result=1
132 # Test subdirs correctly
133 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
134 ${common_objpfx}posix/globtest "$testdir" "*/*" |
136 cat <<"EOF" | cmp - $testout || result=1
141 # Test subdirs for invalid names
142 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
143 ${common_objpfx}posix/globtest "$testdir" "*/1" |
145 cat <<"EOF" | cmp - $testout || result=1
149 # Test subdirs with wildcard
150 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
151 ${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
153 cat <<"EOF" | cmp - $testout || result=1
157 # Test subdirs with ?
158 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
159 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
161 cat <<"EOF" | cmp - $testout || result=1
166 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
167 ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
169 cat <<"EOF" | cmp - $testout || result=1
173 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
174 ${common_objpfx}posix/globtest "$testdir" "*-/*" |
176 cat <<"EOF" | cmp - $testout || result=1
180 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
181 ${common_objpfx}posix/globtest "$testdir" "*-" |
183 cat <<"EOF" | cmp - $testout || result=1
187 # Test subdirs with ?
188 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
189 ${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
191 cat <<"EOF" | cmp - $testout || result=1
196 # Test tilde expansion
197 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
198 ${common_objpfx}posix/globtest -q -t "$testdir" "~" |
201 cmp $testout2 $testout || result=1
203 # Test tilde expansion with trailing slash
204 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
205 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
208 cmp $testout2 $testout || result=1
210 # Test tilde expansion with username
211 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
212 ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
214 eval echo ~$USER > $testout2
215 cmp $testout2 $testout || result=1
217 # Tilde expansion shouldn't match a file
218 #${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
219 #${common_objpfx}posix/globtest -t "$testdir" "~file4" |
221 #cat <<"EOF" | cmp - $testout || result=1
225 # Matching \** should only find *file6
226 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
227 ${common_objpfx}posix/globtest "$testdir" "\**" |
229 cat <<"EOF" | cmp - $testout || result=1
233 # ... unless NOESCAPE is used, in which case it shouldn't match anything.
234 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
235 ${common_objpfx}posix
/globtest
-e "$testdir" "\**" |
237 cat <<"EOF" | cmp - $testout || result=1
241 # Try a recursive failed search
242 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
243 ${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
245 cat <<"EOF" |
cmp - $testout || result
=1
249 # Try multiple patterns (GLOB_APPEND)
250 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
251 ${common_objpfx}posix
/globtest
"$testdir" "file1" "*/*" |
253 cat <<"EOF" | cmp - $testout || result=1
259 # Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
260 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
261 ${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
263 cat <<"EOF" |
cmp - $testout || result
=1
270 # Test NOCHECK with non-existing file in subdir.
271 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
272 ${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
274 cat <<"EOF" | cmp - $testout || result=1
279 if test $result -eq 0; then
280 rm -fr $testdir $testout
285 # Preserve executable bits for this shell script.
287 eval:(defun frobme
() (set-file-modes buffer-file-name file-mode
))
288 eval:(make-local-variable
'file-mode)
289 eval:(setq file-mode (file-modes (buffer-file-name)))
290 eval:(make-local-variable 'after-save-hook
)
291 eval:(add-hook
'after-save-hook 'frobme
)