summaryrefslogtreecommitdiff
path: root/posix/globtest.sh
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-27 17:55:05 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-27 17:55:05 +0000
commit3f62b69af3f0f61299ac7bcbc7c3b35cbd16cf4a (patch)
tree325c502561495d94ab29442c1929afd08ac41686 /posix/globtest.sh
parent6730873037b6afad1504bb237399c343cce18451 (diff)
downloadglibc-3f62b69af3f0f61299ac7bcbc7c3b35cbd16cf4a.tar.gz
Update.
1998-07-27 17:42 Ulrich Drepper <drepper@cygnus.com> * nss/nss_files/files-parse.c (INT_FIELD): Use strtoul instead of strtol. (INT_FIELD_MAYBE_NULL): Likewise. * posix/globtest.c: Rewrite for extended test suite. * posix/globtest.sh: More tests. Patch by Brian Wellington <bwelling@anomaly.munge.com>. * stdlib/strtol.c: Don't redefine LONG_MAX, LONG_MIN, and ULONG_MAX. Use new macro. * sysdeps/generic/readv.c: Correct return type. * sysdeps/generic/writev.c: Likewise. 1998-07-24 Gordon Matzigkeit <gord@fig.org> * argp/argp-help.c (_GNU_SOURCE): Define, to suck in program_invocation_name when compiling outside of glibc. 1998-07-26 Philip Blundell <philb@gnu.org> * sysdeps/unix/sysv/linux/arm/siglist.c: New file; ARM tools don't like `@' in .type directives. * sysdeps/libm-ieee754/e_expf.c (__ieee754_expf): Check whether FE_TONEAREST exists for this platform before using it. * sysdeps/libm-ieee754/e_exp.c (__ieee754_exp): Likewise. * sysdeps/arm/dl-machine.h (elf_machine_rel): Delete redundant debugging code. Correct handling of PC24 relocs. * elf/Makefile (ld-map): Only define if versioning is in use. * sysdeps/arm/fpu_control.h: Move to ... * sysdeps/arm/fpu/fpu_control.h: ... here. * sysdeps/generic/fpu_control.h: Made usable as a dummy implementation. * sysdeps/unix/sysv/linux/arm/brk.c: New file. * sysdeps/arm/machine-gmon.h: Improved profiling for ARM. * sysdeps/arm/sysdep.h (CALL_MCOUNT): Replace stub with real implementation. * sysdeps/unix/sysv/linux/arm/clone.S: Likewise. Based on patch from Scott Bambrough and Pat Beirne. * shlib-versions: Add appropriate definitions for ARM machines. * README.template: Mention that Linux/ARM with ELF works now. 1998-07-18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makerules: Generate compilation rules for all object suffixes, not only those currently selected, for sources in the current or object directory. 1998-07-24 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * posix/fnmatch.c (fnmatch): Allow `/' in character class. Don't match `/' in filename by a character class if requested. * posix/testfnm.c: Rewritten. * posix/testfnm.args: Removed. 1998-07-25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * posix/annexc.c (limits_syms): Add missing symbols. (stdarg_syms): Move va_list to `maybe' list. (stdio_syms): Add FOPEN_MAX.
Diffstat (limited to 'posix/globtest.sh')
-rwxr-xr-xposix/globtest.sh199
1 files changed, 190 insertions, 9 deletions
diff --git a/posix/globtest.sh b/posix/globtest.sh
index d0b78b2ecd..1a417aadd9 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -4,17 +4,28 @@ common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+# Since we use `osrt' we must make sure to use the same locale everywhere.
+LC_ALL=C
+export LC_ALL
+LANG=C
+export LANG
+
# Create the arena
: ${TMPDIR=/tmp}
testdir=$TMPDIR/globtest-dir
testout=$TMPDIR/globtest-out
+testout2=$TMPDIR/globtest-out2
-trap 'rm -fr $testdir $testout' 1 2 3 15
+trap 'rm -fr $testdir $testout $testout2' 1 2 3 15
rm -fr $testdir
mkdir $testdir
echo 1 > $testdir/file1
echo 2 > $testdir/file2
+echo 3 > $testdir/-file3
+echo 4 > $testdir/~file4
+echo 5 > $testdir/.file5
+echo 6 > $testdir/'*file6'
mkdir $testdir/dir1
mkdir $testdir/dir2
echo 1_1 > $testdir/dir1/file1_1
@@ -23,40 +34,130 @@ echo 1_2 > $testdir/dir1/file1_2
# Run some tests.
result=0
+# Normal test
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/globtest "$testdir" "*" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
+`*file6'
+`-file3'
+`dir1'
+`dir2'
+`file1'
+`file2'
+`~file4'
+EOF
+
+# Don't let glob sort it
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/globtest -s "$testdir" "*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`*file6'
+`-file3'
+`dir1'
+`dir2'
+`file1'
+`file2'
+`~file4'
+EOF
+
+# Mark directories
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/globtest -m "$testdir" "*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`*file6'
+`-file3'
+`dir1/'
+`dir2/'
+`file1'
+`file2'
+`~file4'
+EOF
+
+# Find files starting with .
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/globtest -p "$testdir" "*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`*file6'
+`-file3'
+`.'
+`..'
+`.file5'
`dir1'
`dir2'
`file1'
`file2'
-not NULL
+`~file4'
+EOF
+
+# Test braces
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`file1'
+`file2'
+EOF
+
+# Test NOCHECK
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/globtest -c "$testdir" "abc" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`abc'
EOF
+# Test NOMAGIC without magic characters
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/globtest -g "$testdir" "abc" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`abc'
+EOF
+
+# Test NOMAGIC with magic characters
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/globtest -g "$testdir" "abc*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_NOMATCH
+EOF
+
+# Test subdirs correctly
${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
${common_objpfx}posix/globtest "$testdir" "*/*" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1/file1_1'
`dir1/file1_2'
-not NULL
EOF
+# Test subdirs for invalid names
${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
${common_objpfx}posix/globtest "$testdir" "*/1" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
-NULL
EOF
+# Test subdirs with wildcard
${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1/file1_1'
-not NULL
+EOF
+
+# Test subdirs with ?
+${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`dir1/file1_1'
+`dir1/file1_2'
EOF
${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
@@ -64,7 +165,6 @@ ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1/file1_1'
-not NULL
EOF
${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
@@ -72,7 +172,6 @@ ${common_objpfx}posix/globtest "$testdir" "*-/*" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
-NULL
EOF
${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
@@ -80,11 +179,93 @@ ${common_objpfx}posix/globtest "$testdir" "*-" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
-NULL
+EOF
+
+# Test subdirs with ?
+${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
+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 $common_objpfx \
+#${common_objpfx}posix/globtest -q -t "$testdir" "~" |
+#sort >$testout
+#echo ~ > $testout2
+#cmp $testout2 $testout || result=1
+
+# Test tilde expansion with trailing slash
+#${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+#${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
+#sort > $testout
+#echo ~/ > $testout2
+#cmp $testout2 $testout || result=1
+
+# Test tilde expansion with username
+#${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+#${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
+#sort > $testout
+#eval echo ~$USER > $testout2
+#cmp $testout2 $testout || result=1
+
+# Tilde expansion shouldn't match a file
+#${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+#${common_objpfx}posix/globtest -t "$testdir" "~file4" |
+#sort > $testout
+#cat <<"EOF" | cmp - $testout || result=1
+#GLOB_NOMATCH
+#EOF
+
+# Matching \** should only find *file6
+${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+${common_objpfx}posix/globtest "$testdir" "\**" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`*file6'
+EOF
+
+# ... unless NOESCAPE is used, in which case it shouldn't match anything.
+${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+${common_objpfx}posix/globtest -e "$testdir" "\**" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_NOMATCH
+EOF
+
+# Try a recursive failed search
+${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+GLOB_NOMATCH
+EOF
+
+# Try multiple patterns (GLOB_APPEND)
+${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`dir1/file1_1'
+`dir1/file1_2'
+`file1'
+EOF
+
+# Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
+${elf_objpfx}${rtld_installed_name} --library-path $common_objpfx \
+${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
+sort > $testout
+cat <<"EOF" | cmp - $testout || result=1
+`abc'
+`dir1/file1_1'
+`dir1/file1_2'
+`file1'
EOF
if test $result -eq 0; then
- rm -fr $testdir $testout
+ rm -fr $testdir $testout
fi
exit $result