Added new test cases for many of the actions and tests of find

This commit is contained in:
James Youngman
2005-07-31 10:32:18 +00:00
parent 19d57c9a0b
commit 15ea940bfa
45 changed files with 202 additions and 0 deletions

View File

@@ -7,11 +7,20 @@ DEJATOOL = find
EXTRA_DIST_XO = \
find.gnu/comma.xo \
find.gnu/depth.xo \
find.gnu/depth-d.xo \
find.gnu/empty.xo \
find.gnu/execdir-one.xo \
find.gnu/execdir-root-only.xo \
find.gnu/exec-many-rtn-failure.xo \
find.gnu/exec-many-rtn-success.xo \
find.gnu/exec-one-rtn-fail.xo \
find.gnu/exec-one-rtn-success.xo \
find.gnu/false.xo \
find.gnu/follow-basic.xo \
find.gnu/gnuand.xo \
find.gnu/gnu-or.xo \
find.gnu/ipath.xo \
find.gnu/iwholename.xo \
find.gnu/name-opt.xo \
find.gnu/name-period.xo \
find.gnu/perm.xo \
@@ -21,25 +30,47 @@ find.gnu/posix-l.xo \
find.gnu/printf-symlink.xo \
find.gnu/printf-h.xo \
find.gnu/printf.xo \
find.gnu/print0.xo \
find.gnu/prune-default-print.xo \
find.gnu/xtype-symlink.xo \
find.gnu/quit.xo \
find.posix/sv-bug-11175.xo \
find.posix/sv-bug-12181.xo \
find.posix/depth1.xo \
find.posix/sizes.xo \
find.posix/true.xo \
find.posix/name.xo \
find.posix/path.xo \
find.posix/prune.xo \
find.posix/posixnot.xo \
find.posix/grouping.xo \
find.posix/and.xo \
find.posix/exec-one.xo \
find.posix/wholename.xo \
find.gnu/follow-arg-parent-symlink.xo
EXTRA_DIST_EXP = \
config/unix.exp \
find.gnu/comma.exp \
find.gnu/depth.exp \
find.gnu/depth-d.exp \
find.gnu/empty.exp \
find.gnu/execdir-one.exp \
find.gnu/execdir-root-only.exp \
find.gnu/exec-many-rtn-failure.exp \
find.gnu/exec-many-rtn-success.exp \
find.gnu/exec-one-rtn-fail.exp \
find.gnu/exec-one-rtn-success.exp \
find.gnu/follow-basic.exp \
find.gnu/false.exp \
find.gnu/gnuand.exp \
find.gnu/gnu-or.exp \
find.gnu/ipath.exp \
find.gnu/iwholename.exp \
find.gnu/name-opt.exp \
find.gnu/name-period.exp \
find.gnu/path.exp \
find.gnu/print0.exp \
find.gnu/perm.exp \
find.gnu/posix-dflt.exp \
find.gnu/posix-h.exp \
@@ -50,10 +81,19 @@ find.gnu/printf-h.exp \
find.gnu/prune-default-print.exp \
find.gnu/xtype-symlink.exp \
find.gnu/sv-bug-12230.exp \
find.gnu/quit.exp \
find.posix/sv-bug-11175.exp \
find.posix/sv-bug-12181.exp \
find.posix/depth1.exp \
find.posix/sizes.exp \
find.posix/true.exp \
find.posix/name.exp \
find.posix/posixnot.exp \
find.posix/prune.exp \
find.posix/grouping.exp \
find.posix/and.exp \
find.posix/exec-one.exp \
find.posix/wholename.exp \
find.gnu/follow-arg-parent-symlink.exp
EXTRA_DIST = $(EXTRA_DIST_EXP) $(EXTRA_DIST_XO)

View File

@@ -0,0 +1,8 @@
exec rm -rf tmp
exec mkdir tmp
exec mkdir tmp/top
exec mkdir tmp/top/one
exec touch tmp/top/one/foo
exec mkdir tmp/top/two
find_start p {tmp/top -d -mindepth 1 -type d -empty -print}
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/top/two

View File

@@ -0,0 +1,7 @@
# tests for -empty
exec rm -rf tmp
exec mkdir tmp
exec true > tmp/empty
exec echo > tmp/notempty
find_start p { tmp -type f -empty }
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/empty

View File

@@ -0,0 +1,5 @@
# tests for -name
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp -name fred -execdir echo \{\} \; }
exec rm -rf tmp

View File

@@ -0,0 +1 @@
./fred

View File

@@ -0,0 +1,5 @@
# test for -false.
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/fred/jim
find_start p { tmp -depth -print -false -print }
exec rm -rf tmp

View File

@@ -0,0 +1,3 @@
tmp/fred/jim
tmp/fred
tmp

View File

@@ -0,0 +1,10 @@
# Verifies that the -follow option is correctly implemented,
# but does this by using the GNU extension -printf.
exec rm -rf tmp
exec mkdir tmp
exec ln -s /etc/passwd tmp/LINK
exec ln -s /NOSUCHFILE tmp/BROKEN
# Links should all be dereferenced unless they are broken.
find_start p { tmp/LINK tmp/BROKEN tmp -follow -printf "%y %d %p\n" }

View File

@@ -0,0 +1,5 @@
d 0 tmp
f 0 tmp/LINK
f 1 tmp/LINK
l 0 tmp/BROKEN
l 1 tmp/BROKEN

View File

@@ -0,0 +1,5 @@
# test for -false.
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/fred/jim
find_start p { tmp -depth -print -false -or -print }
exec rm -rf tmp

View File

@@ -0,0 +1,6 @@
tmp/fred/jim
tmp/fred/jim
tmp/fred
tmp/fred
tmp
tmp

View File

@@ -0,0 +1,5 @@
# tests for -name
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp -name fred -and -print}
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/fred

View File

@@ -0,0 +1,5 @@
# tests for !
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp -not -name fred -print}
exec rm -rf tmp

View File

@@ -0,0 +1,2 @@
tmp
tmp/jim

View File

@@ -0,0 +1,5 @@
# tests for -name
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp -iname frED -print}
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/fred

View File

@@ -0,0 +1,5 @@
# test for -path
exec rm -rf tmp
exec mkdir tmp tmp/top tmp/top/ONE tmp/top/ONE/two
find_start p {tmp/top -ipath Tmp/TOP/one -print 2>/dev/null }
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/top/ONE

View File

@@ -0,0 +1,5 @@
# test for -iwholename
exec rm -rf tmp
exec mkdir tmp tmp/top tmp/top/one tmp/top/one/two
find_start p {tmp/top -iwholename tmP/TOP/One -print }
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/top/one

View File

@@ -0,0 +1,5 @@
# test for -path
exec rm -rf tmp
exec mkdir tmp tmp/top tmp/top/one tmp/top/one/two
find_start p {tmp/top -path tmp/top/one -print }
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/top/one

View File

@@ -0,0 +1,5 @@
# test for -print0.
exec rm -rf tmp
exec touch tmp
find_start p { tmp -print0 }
exec rm -rf tmp

Binary file not shown.

View File

@@ -0,0 +1,5 @@
# test for -quit.
exec rm -rf tmp
exec mkdir tmp tmp/top tmp/top/one tmp/top/one/foo tmp/top/two
find_start p {tmp/top -depth -print -name one -quit }
exec rm -rf tmp

View File

@@ -0,0 +1,2 @@
tmp/top/one/foo
tmp/top/one

View File

@@ -0,0 +1,5 @@
# test for -true.
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/fred/jim
find_start p { tmp -depth -print -true -print }
exec rm -rf tmp

View File

@@ -0,0 +1,6 @@
tmp/fred/jim
tmp/fred/jim
tmp/fred
tmp/fred
tmp
tmp

View File

@@ -0,0 +1,5 @@
# test for -wholename
exec rm -rf tmp
exec mkdir tmp tmp/top tmp/top/one tmp/top/one/two
find_start p {tmp/top -wholename tmp/top/one -print }
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/top/one

View File

@@ -0,0 +1,5 @@
# tests for -name
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp -name fred -a -print}
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/fred

View File

@@ -0,0 +1,5 @@
# tests for -name
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp -name fred -exec echo \{\} \; }
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/fred

View File

@@ -0,0 +1,5 @@
# tests for !
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp \! \( -name fred -o -name tmp \) -print}
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/jim

View File

@@ -0,0 +1,5 @@
# tests for -name
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp -name fred -print}
exec rm -rf tmp

View File

@@ -0,0 +1 @@
tmp/fred

View File

@@ -0,0 +1,5 @@
# tests for !
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim
find_start p {tmp \! -name fred -print}
exec rm -rf tmp

View File

@@ -0,0 +1,2 @@
tmp
tmp/jim

View File

@@ -0,0 +1,5 @@
# tests for -name
exec rm -rf tmp
exec mkdir tmp tmp/fred tmp/jim tmp/jim/1 tmp/shiela
find_start p {tmp -name jim -prune -o -print }
#exec rm -rf tmp

View File

@@ -0,0 +1,3 @@
tmp
tmp/fred
tmp/shiela