aboutsummaryrefslogtreecommitdiff
path: root/posix/globtest.sh
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-20 00:46:01 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-20 00:46:01 +0000
commit460adbb8475bffc72e749fe841e737e18154b8f5 (patch)
tree540e228ac1a0ae5edc8bc0bfa4d65a034b357562 /posix/globtest.sh
parent4cec02b2ba18a18203c2a0008de8d35f46f92de8 (diff)
downloadglibc-460adbb8475bffc72e749fe841e737e18154b8f5.tar
glibc-460adbb8475bffc72e749fe841e737e18154b8f5.tar.gz
glibc-460adbb8475bffc72e749fe841e737e18154b8f5.tar.bz2
glibc-460adbb8475bffc72e749fe841e737e18154b8f5.zip
Update comment about _SLOWDOWN flags.
Diffstat (limited to 'posix/globtest.sh')
-rwxr-xr-xposix/globtest.sh76
1 files changed, 74 insertions, 2 deletions
diff --git a/posix/globtest.sh b/posix/globtest.sh
index 4a009cc92b..e2ba320358 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -27,9 +27,9 @@ export LANG
testdir=$TMPDIR/globtest-dir
testout=$TMPDIR/globtest-out
-trap 'rm -fr $testdir $testout' 1 2 3 15
+trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15
-rm -fr $testdir
+rm -fr $testdir 2>/dev/null
mkdir $testdir
echo 1 > $testdir/file1
echo 2 > $testdir/file2
@@ -39,6 +39,8 @@ echo 5 > $testdir/.file5
echo 6 > $testdir/'*file6'
mkdir $testdir/dir1
mkdir $testdir/dir2
+test -d $testdir/noread || mkdir $testdir/noread
+chmod a-r $testdir/noread
echo 1_1 > $testdir/dir1/file1_1
echo 1_2 > $testdir/dir1/file1_2
@@ -56,6 +58,7 @@ cat <<"EOF" | cmp - $testout || result=1
`dir2'
`file1'
`file2'
+`noread'
`~file4'
EOF
@@ -70,6 +73,7 @@ cat <<"EOF" | cmp - $testout || result=1
`dir2'
`file1'
`file2'
+`noread'
`~file4'
EOF
@@ -84,6 +88,7 @@ cat <<"EOF" | cmp - $testout || result=1
`dir2/'
`file1'
`file2'
+`noread/'
`~file4'
EOF
@@ -101,6 +106,7 @@ cat <<"EOF" | cmp - $testout || result=1
`dir2'
`file1'
`file2'
+`noread'
`~file4'
EOF
@@ -201,6 +207,24 @@ cat <<"EOF" | cmp - $testout || result=1
`dir1/file1_2'
EOF
+# Test subdirs with [ .. ]
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`dir1/file1_1'
+`dir1/file1_2'
+EOF
+
+# Test ']' inside bracket expression
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`dir1/file1_1'
+`dir1/file1_2'
+EOF
+
# Test tilde expansion
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -q -t "$testdir" "~" |
@@ -243,6 +267,14 @@ cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
EOF
+# Matching \*file6 should find *file6
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest "$testdir" "\*file6" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`*file6'
+EOF
+
# Try a recursive failed search
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
@@ -251,6 +283,44 @@ cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
EOF
+# ... with GLOB_ERR
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_NOMATCH
+EOF
+
+# Try a recursive search in unreadable directory
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest "$testdir" "noread/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_NOMATCH
+EOF
+
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest "$testdir" "noread*/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_NOMATCH
+EOF
+
+# ... with GLOB_ERR
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_ABORTED
+EOF
+
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_ABORTED
+EOF
+
# Try multiple patterns (GLOB_APPEND)
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
@@ -279,9 +349,11 @@ sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1/blahblah'
`dir2/blahblah'
+`noread/blahblah'
EOF
if test $result -eq 0; then
+ chmod 777 $testdir/noread
rm -fr $testdir $testout
fi