2016-01-07 08:51:53 +00:00
|
|
|
#!/bin/bash
|
2012-09-24 20:58:00 +00:00
|
|
|
# Test for glob(3).
|
2020-01-01 00:14:33 +00:00
|
|
|
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
2012-09-24 20:58:00 +00:00
|
|
|
# This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
# <https://www.gnu.org/licenses/>.
|
1997-09-16 00:42:43 +00:00
|
|
|
|
2012-09-24 20:52:13 +00:00
|
|
|
set -e
|
|
|
|
|
1997-09-16 00:42:43 +00:00
|
|
|
common_objpfx=$1; shift
|
2013-01-11 15:14:18 +00:00
|
|
|
test_via_rtld_prefix=$1; shift
|
|
|
|
test_program_prefix=$1; shift
|
2012-10-24 21:59:01 +00:00
|
|
|
test_wrapper_env=$1; shift
|
2000-07-23 01:23:29 +00:00
|
|
|
logfile=$common_objpfx/posix/globtest.out
|
1997-09-16 00:42:43 +00:00
|
|
|
|
2003-10-26 20:47:33 +00:00
|
|
|
#CMP=cmp
|
|
|
|
CMP="diff -u"
|
|
|
|
|
1999-03-05 15:02:32 +00:00
|
|
|
# We have to make the paths `common_objpfx' absolute.
|
|
|
|
case "$common_objpfx" in
|
|
|
|
.*)
|
|
|
|
common_objpfx="`pwd`/$common_objpfx"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1998-08-08 20:02:34 +00:00
|
|
|
# Since we use `sort' we must make sure to use the same locale everywhere.
|
1998-07-27 17:55:05 +00:00
|
|
|
LC_ALL=C
|
|
|
|
export LC_ALL
|
|
|
|
|
1997-09-16 00:42:43 +00:00
|
|
|
# Create the arena
|
2012-10-24 11:47:16 +00:00
|
|
|
testdir=${common_objpfx}posix/globtest-dir
|
|
|
|
testout=${common_objpfx}posix/globtest-out
|
|
|
|
rm -rf $testdir $testout
|
|
|
|
mkdir $testdir
|
1997-09-16 00:42:43 +00:00
|
|
|
|
2017-04-11 18:08:02 +00:00
|
|
|
cleanup() {
|
|
|
|
chmod 777 $testdir/noread
|
|
|
|
rm -fr $testdir $testout
|
|
|
|
}
|
|
|
|
|
|
|
|
trap cleanup 0 HUP INT QUIT TERM
|
1997-09-16 00:42:43 +00:00
|
|
|
|
|
|
|
echo 1 > $testdir/file1
|
|
|
|
echo 2 > $testdir/file2
|
1998-07-27 17:55:05 +00:00
|
|
|
echo 3 > $testdir/-file3
|
|
|
|
echo 4 > $testdir/~file4
|
|
|
|
echo 5 > $testdir/.file5
|
|
|
|
echo 6 > $testdir/'*file6'
|
2003-10-26 20:47:33 +00:00
|
|
|
echo 7 > $testdir/'{file7,}'
|
|
|
|
echo 8 > $testdir/'\{file8\}'
|
|
|
|
echo 9 > $testdir/'\{file9\,file9b\}'
|
|
|
|
echo 9 > $testdir/'\file9b\' #'
|
|
|
|
echo a > $testdir/'filea,'
|
|
|
|
echo a > $testdir/'fileb}c'
|
1997-09-16 00:42:43 +00:00
|
|
|
mkdir $testdir/dir1
|
|
|
|
mkdir $testdir/dir2
|
2000-03-20 00:46:01 +00:00
|
|
|
test -d $testdir/noread || mkdir $testdir/noread
|
|
|
|
chmod a-r $testdir/noread
|
1997-09-16 00:42:43 +00:00
|
|
|
echo 1_1 > $testdir/dir1/file1_1
|
|
|
|
echo 1_2 > $testdir/dir1/file1_2
|
2003-06-04 05:12:46 +00:00
|
|
|
ln -fs dir1 $testdir/link1
|
1997-09-16 00:42:43 +00:00
|
|
|
|
|
|
|
# Run some tests.
|
|
|
|
result=0
|
2000-07-23 01:23:29 +00:00
|
|
|
rm -f $logfile
|
1997-09-16 00:42:43 +00:00
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Normal test
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-02-24 15:22:29 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*" |
|
1997-09-16 00:42:43 +00:00
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`*file6'
|
|
|
|
`-file3'
|
2003-10-26 20:47:33 +00:00
|
|
|
`\file9b\'
|
|
|
|
`\{file8\}'
|
|
|
|
`\{file9\,file9b\}'
|
1998-07-27 17:55:05 +00:00
|
|
|
`dir1'
|
|
|
|
`dir2'
|
|
|
|
`file1'
|
|
|
|
`file2'
|
2003-10-26 20:47:33 +00:00
|
|
|
`filea,'
|
|
|
|
`fileb}c'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1'
|
2000-03-20 00:46:01 +00:00
|
|
|
`noread'
|
2003-10-26 20:47:33 +00:00
|
|
|
`{file7,}'
|
1998-07-27 17:55:05 +00:00
|
|
|
`~file4'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Normal test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Don't let glob sort it
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -s "$testdir" "*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`*file6'
|
|
|
|
`-file3'
|
2003-10-26 20:47:33 +00:00
|
|
|
`\file9b\'
|
|
|
|
`\{file8\}'
|
|
|
|
`\{file9\,file9b\}'
|
1998-07-27 17:55:05 +00:00
|
|
|
`dir1'
|
|
|
|
`dir2'
|
|
|
|
`file1'
|
|
|
|
`file2'
|
2003-10-26 20:47:33 +00:00
|
|
|
`filea,'
|
|
|
|
`fileb}c'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1'
|
2000-03-20 00:46:01 +00:00
|
|
|
`noread'
|
2003-10-26 20:47:33 +00:00
|
|
|
`{file7,}'
|
1998-07-27 17:55:05 +00:00
|
|
|
`~file4'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "No sort test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Mark directories
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -m "$testdir" "*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`*file6'
|
|
|
|
`-file3'
|
2003-10-26 20:47:33 +00:00
|
|
|
`\file9b\'
|
|
|
|
`\{file8\}'
|
|
|
|
`\{file9\,file9b\}'
|
1998-07-27 17:55:05 +00:00
|
|
|
`dir1/'
|
|
|
|
`dir2/'
|
|
|
|
`file1'
|
|
|
|
`file2'
|
2003-10-26 20:47:33 +00:00
|
|
|
`filea,'
|
|
|
|
`fileb}c'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/'
|
2000-03-20 00:46:01 +00:00
|
|
|
`noread/'
|
2003-10-26 20:47:33 +00:00
|
|
|
`{file7,}'
|
1998-07-27 17:55:05 +00:00
|
|
|
`~file4'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Mark directories test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Find files starting with .
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -p "$testdir" "*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`*file6'
|
|
|
|
`-file3'
|
|
|
|
`.'
|
|
|
|
`..'
|
|
|
|
`.file5'
|
2003-10-26 20:47:33 +00:00
|
|
|
`\file9b\'
|
|
|
|
`\{file8\}'
|
|
|
|
`\{file9\,file9b\}'
|
1997-09-16 00:42:43 +00:00
|
|
|
`dir1'
|
|
|
|
`dir2'
|
|
|
|
`file1'
|
|
|
|
`file2'
|
2003-10-26 20:47:33 +00:00
|
|
|
`filea,'
|
|
|
|
`fileb}c'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1'
|
2000-03-20 00:46:01 +00:00
|
|
|
`noread'
|
2003-10-26 20:47:33 +00:00
|
|
|
`{file7,}'
|
1998-07-27 17:55:05 +00:00
|
|
|
`~file4'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Leading period test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Test braces
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`file1'
|
|
|
|
`file2'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Braces test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
2001-11-29 21:57:56 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2001-11-29 21:57:56 +00:00
|
|
|
${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2001-11-29 21:57:56 +00:00
|
|
|
`-file3'
|
|
|
|
`file1'
|
|
|
|
`file2'
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Braces test 2 failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2001-11-29 21:57:56 +00:00
|
|
|
${common_objpfx}posix/globtest -b "$testdir" "{" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2001-11-29 21:57:56 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Braces test 3 failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Test NOCHECK
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -c "$testdir" "abc" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`abc'
|
1997-09-16 00:42:43 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "No check test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1997-09-16 00:42:43 +00:00
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Test NOMAGIC without magic characters
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -g "$testdir" "abc" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`abc'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "No magic test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Test NOMAGIC with magic characters
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -g "$testdir" "abc*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "No magic w/ magic chars test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
2002-04-29 04:32:06 +00:00
|
|
|
# Test NOMAGIC for subdirs
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2002-04-29 04:32:06 +00:00
|
|
|
${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2002-04-29 04:32:06 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "No magic in subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Test subdirs correctly
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-02-24 15:22:29 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*/*" |
|
1997-09-16 00:42:43 +00:00
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1997-09-16 00:42:43 +00:00
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file1_2'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
|
|
|
`link1/file1_2'
|
1997-09-16 00:42:43 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Subdirs test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1997-09-16 00:42:43 +00:00
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Test subdirs for invalid names
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-02-24 15:22:29 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*/1" |
|
1997-09-16 00:42:43 +00:00
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1997-09-16 00:42:43 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Invalid subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1997-09-16 00:42:43 +00:00
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Test subdirs with wildcard
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-02-24 15:22:29 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
|
1997-09-16 00:42:43 +00:00
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1997-09-16 00:42:43 +00:00
|
|
|
`dir1/file1_1'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
1998-07-27 17:55:05 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Wildcard subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Test subdirs with ?
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file1_2'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
|
|
|
`link1/file1_2'
|
1997-09-16 00:42:43 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Wildcard2 subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1997-09-16 00:42:43 +00:00
|
|
|
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-02-24 15:22:29 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
|
1997-09-16 00:42:43 +00:00
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1997-09-16 00:42:43 +00:00
|
|
|
`dir1/file1_1'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
1997-09-16 00:42:43 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Wildcard3 subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1997-09-16 00:42:43 +00:00
|
|
|
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-02-24 15:22:29 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*-/*" |
|
1997-09-16 00:42:43 +00:00
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1997-09-16 00:42:43 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Wildcard4 subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1997-09-16 00:42:43 +00:00
|
|
|
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-02-24 15:22:29 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*-" |
|
1997-09-16 00:42:43 +00:00
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1997-09-16 00:42:43 +00:00
|
|
|
GLOB_NOMATCH
|
1998-07-27 17:55:05 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Wildcard5 subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Test subdirs with ?
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file1_2'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
|
|
|
`link1/file1_2'
|
1998-07-27 17:55:05 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Wildcard6 subdir test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
2000-03-20 00:46:01 +00:00
|
|
|
# Test subdirs with [ .. ]
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-03-20 00:46:01 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file1_2'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
|
|
|
`link1/file1_2'
|
2000-03-20 00:46:01 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Brackets test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
2000-03-20 00:46:01 +00:00
|
|
|
|
|
|
|
# Test ']' inside bracket expression
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-03-20 00:46:01 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file1_2'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Brackets2 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
2000-03-20 00:46:01 +00:00
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Test tilde expansion
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 22:28:11 +00:00
|
|
|
${common_objpfx}posix/globtest -q -t "$testdir" "~" |
|
|
|
|
sort >$testout
|
2003-10-26 20:47:33 +00:00
|
|
|
echo ~ | $CMP - $testout >> $logfile || failed=1
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
2001-08-09 17:40:23 +00:00
|
|
|
if test -d ~; then
|
|
|
|
echo "Tilde test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
else
|
|
|
|
echo "Tilde test could not be run" >> $logfile
|
|
|
|
fi
|
2000-07-23 01:23:29 +00:00
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Test tilde expansion with trailing slash
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 22:28:11 +00:00
|
|
|
${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
|
|
|
|
sort > $testout
|
2000-04-13 07:30:27 +00:00
|
|
|
# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
|
|
|
|
if test ~/ = //; then
|
2003-10-26 20:47:33 +00:00
|
|
|
echo / | $CMP - $testout >> $logfile || failed=1
|
2000-04-13 07:30:27 +00:00
|
|
|
else
|
2003-10-26 20:47:33 +00:00
|
|
|
echo ~/ | $CMP - $testout >> $logfile || failed=1
|
2000-07-23 01:23:29 +00:00
|
|
|
fi
|
|
|
|
if test $failed -ne 0; then
|
2001-08-09 17:40:23 +00:00
|
|
|
if test -d ~/; then
|
|
|
|
echo "Tilde2 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
else
|
|
|
|
echo "Tilde2 test could not be run" >> $logfile
|
|
|
|
fi
|
2000-04-13 15:13:26 +00:00
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
2000-04-27 04:03:53 +00:00
|
|
|
# Test tilde expansion with username
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-04-27 04:03:53 +00:00
|
|
|
${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
2001-08-09 17:40:23 +00:00
|
|
|
if eval test -d ~$USER; then
|
|
|
|
echo "Tilde3 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
else
|
|
|
|
echo "Tilde3 test could not be run" >> $logfile
|
|
|
|
fi
|
2000-07-23 01:23:29 +00:00
|
|
|
fi
|
2000-04-27 04:03:53 +00:00
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Tilde expansion shouldn't match a file
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-28 20:47:08 +00:00
|
|
|
${common_objpfx}posix/globtest -T "$testdir" "~file4" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-28 20:47:08 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Tilde4 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Matching \** should only find *file6
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "\**" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`*file6'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Star test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
2003-10-26 20:47:33 +00:00
|
|
|
# ... unless NOESCAPE is used, in which case it should entries with a
|
|
|
|
# leading \.
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -e "$testdir" "\**" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`\file9b\'
|
|
|
|
`\{file8\}'
|
|
|
|
`\{file9\,file9b\}'
|
1998-07-27 17:55:05 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Star2 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
2000-03-20 00:46:01 +00:00
|
|
|
# Matching \*file6 should find *file6
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-03-20 00:46:01 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "\*file6" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
`*file6'
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Star3 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
2000-03-20 00:46:01 +00:00
|
|
|
|
2003-10-26 20:47:33 +00:00
|
|
|
# GLOB_BRACE alone
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2003-10-26 20:47:33 +00:00
|
|
|
${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
|
|
|
|
sort > $testout
|
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`{file7,}'
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Brace4 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# GLOB_BRACE and GLOB_NOESCAPE
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2003-10-26 20:47:33 +00:00
|
|
|
${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
|
|
|
|
sort > $testout
|
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`\file9b\'
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Brace5 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Escaped comma
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2003-10-26 20:47:33 +00:00
|
|
|
${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
|
|
|
|
sort > $testout
|
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`filea,'
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Brace6 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Escaped closing brace
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2003-10-26 20:47:33 +00:00
|
|
|
${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
|
|
|
|
sort > $testout
|
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`fileb}c'
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Brace7 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Try a recursive failed search
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Star4 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
2000-03-20 00:46:01 +00:00
|
|
|
# ... with GLOB_ERR
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-03-20 00:46:01 +00:00
|
|
|
${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Star5 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
2000-03-20 00:46:01 +00:00
|
|
|
|
|
|
|
# Try a recursive search in unreadable directory
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-03-20 00:46:01 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "noread/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Star6 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
2000-03-20 00:46:01 +00:00
|
|
|
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-03-20 00:46:01 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "noread*/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
GLOB_NOMATCH
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Star6 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
2000-03-20 00:46:01 +00:00
|
|
|
|
2000-04-10 15:55:35 +00:00
|
|
|
# The following tests will fail if run as root.
|
|
|
|
user=`id -un 2> /dev/null`
|
|
|
|
if test -z "$user"; then
|
|
|
|
uid="$USER"
|
|
|
|
fi
|
|
|
|
if test "$user" != root; then
|
|
|
|
# ... with GLOB_ERR
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-04-10 15:55:35 +00:00
|
|
|
${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
GLOB_ABORTED
|
|
|
|
EOF
|
|
|
|
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2000-04-11 16:27:38 +00:00
|
|
|
${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2000-03-20 00:46:01 +00:00
|
|
|
GLOB_ABORTED
|
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "GLOB_ERR test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
2000-04-11 16:27:38 +00:00
|
|
|
fi # not run as root
|
2000-03-20 00:46:01 +00:00
|
|
|
|
1998-07-27 17:55:05 +00:00
|
|
|
# Try multiple patterns (GLOB_APPEND)
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file1_2'
|
|
|
|
`file1'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
|
|
|
`link1/file1_2'
|
1998-07-27 17:55:05 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "GLOB_APPEND test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-27 17:55:05 +00:00
|
|
|
|
|
|
|
# Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-27 17:55:05 +00:00
|
|
|
${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
1998-07-27 17:55:05 +00:00
|
|
|
`abc'
|
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file1_2'
|
|
|
|
`file1'
|
2003-06-04 05:12:46 +00:00
|
|
|
`link1/file1_1'
|
|
|
|
`link1/file1_2'
|
1997-09-16 00:42:43 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "GLOB_APPEND2 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1997-09-16 00:42:43 +00:00
|
|
|
|
1998-07-28 16:26:04 +00:00
|
|
|
# Test NOCHECK with non-existing file in subdir.
|
2000-07-23 01:23:29 +00:00
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
1998-07-28 16:26:04 +00:00
|
|
|
${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
|
|
|
|
sort > $testout
|
2003-10-26 20:47:33 +00:00
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
2001-12-10 12:21:07 +00:00
|
|
|
`*/blahblah'
|
1998-07-28 16:26:04 +00:00
|
|
|
EOF
|
2000-07-23 01:23:29 +00:00
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "No check2 test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
1998-07-28 16:26:04 +00:00
|
|
|
|
2003-10-27 01:36:12 +00:00
|
|
|
# Test [[:punct:]] not matching leading period.
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2003-10-27 01:36:12 +00:00
|
|
|
${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" |
|
|
|
|
sort > $testout
|
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`*file6'
|
|
|
|
`-file3'
|
|
|
|
`\file9b\'
|
|
|
|
`\{file8\}'
|
|
|
|
`\{file9\,file9b\}'
|
|
|
|
`{file7,}'
|
|
|
|
`~file4'
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Punct test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
2007-02-14 19:52:38 +00:00
|
|
|
mkdir $testdir/'dir3*'
|
|
|
|
echo 1 > $testdir/'dir3*'/file1
|
|
|
|
mkdir $testdir/'dir4[a'
|
|
|
|
echo 2 > $testdir/'dir4[a'/file1
|
|
|
|
echo 3 > $testdir/'dir4[a'/file2
|
|
|
|
mkdir $testdir/'dir5[ab]'
|
|
|
|
echo 4 > $testdir/'dir5[ab]'/file1
|
|
|
|
echo 5 > $testdir/'dir5[ab]'/file2
|
|
|
|
mkdir $testdir/dir6
|
|
|
|
echo 6 > $testdir/dir6/'file1[a'
|
|
|
|
echo 7 > $testdir/dir6/'file1[ab]'
|
|
|
|
failed=0
|
2013-01-11 15:14:18 +00:00
|
|
|
v=`${test_program_prefix} \
|
2007-02-14 19:52:38 +00:00
|
|
|
${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'`
|
|
|
|
test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2007-02-14 19:52:38 +00:00
|
|
|
${common_objpfx}posix/globtest -c "$testdir" \
|
|
|
|
'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \
|
|
|
|
'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \
|
2011-01-14 13:06:22 +00:00
|
|
|
'dir6/fil*[a' 'dir*6/file1[a' 'dir6/fi*l[ab]' 'dir*6/file1[ab]' \
|
|
|
|
'dir6/file1[[.a.]*' |
|
2007-02-14 19:52:38 +00:00
|
|
|
sort > $testout
|
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`dir*6/file1[ab]'
|
|
|
|
`dir1/file1_1'
|
|
|
|
`dir1/file\1_9'
|
|
|
|
`dir2/'
|
|
|
|
`dir3*/file1'
|
|
|
|
`dir3\*/file2'
|
2011-01-14 13:06:22 +00:00
|
|
|
`dir4[a/file1'
|
|
|
|
`dir4[a/file2'
|
2007-02-14 19:52:38 +00:00
|
|
|
`dir5[ab]/file[12]'
|
|
|
|
`dir6/fi*l[ab]'
|
2011-01-14 13:06:22 +00:00
|
|
|
`dir6/file1[a'
|
|
|
|
`dir6/file1[a'
|
|
|
|
`dir6/file1[a'
|
|
|
|
`dir6/file1[ab]'
|
2007-02-14 19:52:38 +00:00
|
|
|
`nondir\/'
|
|
|
|
EOF
|
2012-10-24 21:59:01 +00:00
|
|
|
${test_wrapper_env} \
|
2007-02-14 19:52:38 +00:00
|
|
|
HOME="$testdir" \
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_via_rtld_prefix} \
|
2007-02-14 19:52:38 +00:00
|
|
|
${common_objpfx}posix/globtest -ct "$testdir" \
|
|
|
|
'~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \
|
|
|
|
'~\/dir1/file1_2' |
|
|
|
|
sort > $testout
|
|
|
|
cat <<EOF | $CMP - $testout >> $logfile || failed=1
|
|
|
|
\`$testdir/dir1/file1_1'
|
|
|
|
\`$testdir/dir1/file1_2'
|
|
|
|
\`$testdir/dir3*/file1'
|
|
|
|
\`~/dir1/file1_9'
|
|
|
|
\`~/dir3\\*/file2'
|
|
|
|
EOF
|
|
|
|
if eval test -d ~"$USER"/; then
|
|
|
|
user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'`
|
|
|
|
if test -n "$user"; then
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2007-02-14 19:52:38 +00:00
|
|
|
${common_objpfx}posix/globtest -ctq "$testdir" "$user/" |
|
|
|
|
sort > $testout
|
|
|
|
eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2007-02-14 19:52:38 +00:00
|
|
|
${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" |
|
|
|
|
sort > $testout
|
|
|
|
eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1
|
2013-01-11 15:14:18 +00:00
|
|
|
${test_program_prefix} \
|
2007-02-14 19:52:38 +00:00
|
|
|
${common_objpfx}posix/globtest -ctq "$testdir" "$user" |
|
|
|
|
sort > $testout
|
|
|
|
eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "Escape tests failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
2016-10-20 08:04:41 +00:00
|
|
|
# Test GLOB_BRACE and GLIB_DOOFFS with malloc checking
|
|
|
|
failed=0
|
|
|
|
${test_wrapper_env} \
|
|
|
|
MALLOC_PERTURB_=65 \
|
|
|
|
${test_via_rtld_prefix} \
|
|
|
|
${common_objpfx}posix/globtest -b -o "$testdir" "file{1,2}" > $testout || failed=1
|
|
|
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
|
|
|
`abc'
|
|
|
|
`file1'
|
|
|
|
`file2'
|
|
|
|
EOF
|
|
|
|
if test $failed -ne 0; then
|
|
|
|
echo "GLOB_BRACE+GLOB_DOOFFS test failed" >> $logfile
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
1997-09-16 00:42:43 +00:00
|
|
|
if test $result -eq 0; then
|
2000-07-23 01:23:29 +00:00
|
|
|
echo "All OK." > $logfile
|
1997-09-16 00:42:43 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit $result
|
|
|
|
|
|
|
|
# Preserve executable bits for this shell script.
|
|
|
|
Local Variables:
|
|
|
|
eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
|
|
|
|
eval:(make-local-variable 'file-mode)
|
|
|
|
eval:(setq file-mode (file-modes (buffer-file-name)))
|
|
|
|
eval:(make-local-variable 'after-save-hook)
|
|
|
|
eval:(add-hook 'after-save-hook 'frobme)
|
|
|
|
End:
|