summaryrefslogtreecommitdiff
path: root/tests/find
diff options
context:
space:
mode:
Diffstat (limited to 'tests/find')
-rwxr-xr-xtests/find/debug-missing-arg.sh12
-rwxr-xr-xtests/find/exec-plus-last-file.sh10
-rwxr-xr-xtests/find/execdir-fd-leak.sh12
-rwxr-xr-xtests/find/many-dir-entries-vs-OOM.sh22
-rwxr-xr-xtests/find/name-lbracket-literal.sh5
-rwxr-xr-xtests/find/printf_escape_c.sh17
-rwxr-xr-xtests/find/printf_escapechars.sh50
-rwxr-xr-xtests/find/printf_inode.sh12
-rwxr-xr-xtests/find/refuse-noop.sh18
-rwxr-xr-xtests/find/type_list.sh290
10 files changed, 208 insertions, 240 deletions
diff --git a/tests/find/debug-missing-arg.sh b/tests/find/debug-missing-arg.sh
index ce8dffaf..776f295d 100755
--- a/tests/find/debug-missing-arg.sh
+++ b/tests/find/debug-missing-arg.sh
@@ -19,14 +19,10 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
-# Exercise both find executables.
-for exe in find oldfind; do
- rm -f out err || framework_failure_
- returns_ 1 "$exe" -D >/dev/null 2> err || fail=1
- grep -F "find: Missing argument after the -D option." err \
- || { cat err; fail=1; }
-done
+returns_ 1 find -D >/dev/null 2> err || fail=1
+grep -F "find: Missing argument after the -D option." err \
+ || { cat err; fail=1; }
Exit $fail
diff --git a/tests/find/exec-plus-last-file.sh b/tests/find/exec-plus-last-file.sh
index 596f544b..e9001b64 100755
--- a/tests/find/exec-plus-last-file.sh
+++ b/tests/find/exec-plus-last-file.sh
@@ -21,7 +21,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
# Require seq(1) for this test - which may not be available
# on some systems, e.g on some *BSDs.
@@ -57,10 +57,8 @@ mkdir "$DIR" \
|| framework_failure_
-for exe in find oldfind; do
- "$exe" "$DIR" -type f -exec "$CMD" '{}' + > out || fail=1
- LC_ALL=C sort out > out2 || fail=1
- compare exp out2 || fail=1
-done
+find "$DIR" -type f -exec "$CMD" '{}' + > out || fail=1
+LC_ALL=C sort out > out2 || fail=1
+compare exp out2 || fail=1
Exit $fail
diff --git a/tests/find/execdir-fd-leak.sh b/tests/find/execdir-fd-leak.sh
index 4fbf0a5c..2b680f5e 100755
--- a/tests/find/execdir-fd-leak.sh
+++ b/tests/find/execdir-fd-leak.sh
@@ -19,7 +19,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
# seq is not required by POSIX, so we have manual lists of number here instead.
three_to_thirty_five="3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35"
@@ -55,12 +55,10 @@ make_test_data() {
make_test_data \
|| framework_failure_ "failed to set up the test"
-for exe in find oldfind; do
- ( ulimit -n 30 && \
- ${exe} . -type f -execdir cat '{}' \; >/dev/null; \
- ) \
- || { echo "Option -execdir of ${exe} leaks file descriptors" >&2 ; \
+( ulimit -n 30 && \
+ find . -type f -execdir cat '{}' \; >/dev/null; \
+) \
+ || { echo "Option -execdir leaks file descriptors" >&2 ; \
fail=1 ; }
-done
Exit $fail
diff --git a/tests/find/many-dir-entries-vs-OOM.sh b/tests/find/many-dir-entries-vs-OOM.sh
index 8ab343f7..d2edb253 100755
--- a/tests/find/many-dir-entries-vs-OOM.sh
+++ b/tests/find/many-dir-entries-vs-OOM.sh
@@ -19,7 +19,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
# Mark as expensive.
expensive_
@@ -77,18 +77,12 @@ cd ..
# Create a small directory as reference to determine lower ulimit.
mkdir dir2 && touch dir2/a dir2/b dir2/c || framework_failure_
-# We don't check oldfind, as it uses savedir, meaning that
-# it stores all the directory entries. Hence the excessive
-# memory consumption bug applies to oldfind even though it is
-# not using fts.
-for exe in find oldfind; do
- # Determine memory consumption for the trivial case.
- vm="$(get_min_ulimit_v_ ${exe} dir2 -fprint dummy)" \
- || skip_ "this shell lacks ulimit support"
-
- # Allow 35MiB more memory than above.
- ( ulimit -v $(($vm + 35000)) && ${exe} dir >/dev/null ) \
- || { echo "${exe}: memory consumption is too high" >&2; fail=1; }
-done
+# Determine memory consumption for the trivial case.
+vm="$(get_min_ulimit_v_ find dir2 -fprint dummy)" \
+ || skip_ "this shell lacks ulimit support"
+
+# Allow 35MiB more memory than above.
+( ulimit -v $(($vm + 35000)) && find dir >/dev/null ) \
+ || { echo "memory consumption is too high" >&2; fail=1; }
Exit $fail
diff --git a/tests/find/name-lbracket-literal.sh b/tests/find/name-lbracket-literal.sh
index 9f5583d2..b3a6be58 100755
--- a/tests/find/name-lbracket-literal.sh
+++ b/tests/find/name-lbracket-literal.sh
@@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
# Prepare a file named '['.
touch '[' || framework_failure_
@@ -27,7 +27,4 @@ echo './[' > exp || framework_failure_
find -name '[' -print > out || fail=1
compare exp out || fail=1
-oldfind -name '[' -print > out2 || fail=1
-compare exp out2 || fail=1
-
Exit $fail
diff --git a/tests/find/printf_escape_c.sh b/tests/find/printf_escape_c.sh
index 6a938a2d..530ac7b8 100755
--- a/tests/find/printf_escape_c.sh
+++ b/tests/find/printf_escape_c.sh
@@ -17,19 +17,16 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
echo 'hello^.^world' > exp || framework_failure_
-for executable in oldfind find; do
- rm -f out || framework_failure_
- $executable . -maxdepth 0 \
- -printf 'hello^\cthere' \
- -exec printf %s {} \; \
- -printf '^world\n' \
- > out || fail=1
+find . -maxdepth 0 \
+ -printf 'hello^\cthere' \
+ -exec printf %s {} \; \
+ -printf '^world\n' \
+ > out || fail=1
- compare exp out || fail=1
-done
+compare exp out || fail=1
Exit $fail
diff --git a/tests/find/printf_escapechars.sh b/tests/find/printf_escapechars.sh
index 8d6dcebe..55900e59 100755
--- a/tests/find/printf_escapechars.sh
+++ b/tests/find/printf_escapechars.sh
@@ -17,7 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
# Check for working od(1).
echo test | od -c >/dev/null \
@@ -54,33 +54,29 @@ _EOD_
# Prepare expected stderr.
echo "warning: unrecognized escape" > experr || framework_failure_
-for executable in oldfind find; do
- rm -f out* err* || framework_failure_
+find . -maxdepth 0 \
+ -printf 'OCTAL1: \1\n' \
+ -printf 'OCTAL2: \02\n' \
+ -printf 'OCTAL3: \003\n' \
+ -printf 'OCTAL4: \0044\n' \
+ -printf 'OCTAL8: \0028\n' \
+ -printf 'BEL: \a\n' \
+ -printf 'CR: \r\n' \
+ -printf 'FF: \f\n' \
+ -printf 'TAB: \t\n' \
+ -printf 'VTAB: \v\n' \
+ -printf 'BS: \b\n' \
+ -printf 'BACKSLASH: \\\n' \
+ -printf 'UNKNOWN: \z\n' \
+ > out 2> err || fail=1
- $executable . -maxdepth 0 \
- -printf 'OCTAL1: \1\n' \
- -printf 'OCTAL2: \02\n' \
- -printf 'OCTAL3: \003\n' \
- -printf 'OCTAL4: \0044\n' \
- -printf 'OCTAL8: \0028\n' \
- -printf 'BEL: \a\n' \
- -printf 'CR: \r\n' \
- -printf 'FF: \f\n' \
- -printf 'TAB: \t\n' \
- -printf 'VTAB: \v\n' \
- -printf 'BS: \b\n' \
- -printf 'BACKSLASH: \\\n' \
- -printf 'UNKNOWN: \z\n' \
- > out 2> err || fail=1
+# Some 'od' implementations (e.g. on the *BSDs) produce different indentation
+# and trailing spaces, therefore squeeze the former and remove the latter.
+od -t o1 < out | sed 's/ */ /g; s/ *$//;' > out2 || framework_failure_
+compare expout out2 || fail=1
- # Some 'od' implementations (e.g. on the *BSDs) produce different indentation
- # and trailing spaces, therefore squeeze the former and remove the latter.
- od -t o1 < out | sed 's/ */ /g; s/ *$//;' > out2 || framework_failure_
- compare expout out2 || fail=1
-
- sed 's/^.*\(warning: unrecognized escape\) .*$/\1/' err > err2 \
- || framework_failure_
- compare experr err2 || fail=1
-done
+sed 's/^.*\(warning: unrecognized escape\) .*$/\1/' err > err2 \
+ || framework_failure_
+compare experr err2 || fail=1
Exit $fail
diff --git a/tests/find/printf_inode.sh b/tests/find/printf_inode.sh
index 53925d2b..40e918ff 100755
--- a/tests/find/printf_inode.sh
+++ b/tests/find/printf_inode.sh
@@ -17,7 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
make_canonical() {
sed -e '
@@ -33,11 +33,9 @@ make_canonical() {
# Let ls(1) create the expected output.
ls -i file | make_canonical > exp || framework_failure_
-for executable in oldfind find; do
- rm -f out out2
- $executable file -printf '%i_%p\n' > out || fail=1
- make_canonical < out > out2 || framework_failure_
- compare exp out2 || fail=1
-done
+rm -f out out2
+find file -printf '%i_%p\n' > out || fail=1
+make_canonical < out > out2 || framework_failure_
+compare exp out2 || fail=1
Exit $fail
diff --git a/tests/find/refuse-noop.sh b/tests/find/refuse-noop.sh
index d896ee26..a2a1a53f 100755
--- a/tests/find/refuse-noop.sh
+++ b/tests/find/refuse-noop.sh
@@ -19,18 +19,16 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
# Exercise both the previous name of the pseudo-option '-noop',
-# and the now renamed '---noop' option for both find executables.
-for exe in find oldfind; do
- for opt in 'noop' '--noop'; do
- rm -f out err || framework_failure_
- returns_ 1 "$exe" "-${opt}" > out 2> err || fail=1
- compare /dev/null out || fail=1
- grep "find: unknown predicate .-${opt}." err \
- || { cat err; fail=1; }
- done
+# and the now renamed '---noop' option.
+for opt in 'noop' '--noop'; do
+ rm -f out err || framework_failure_
+ returns_ 1 find "-${opt}" > out 2> err || fail=1
+ compare /dev/null out || fail=1
+ grep "find: unknown predicate .-${opt}." err \
+ || { cat err; fail=1; }
done
Exit $fail
diff --git a/tests/find/type_list.sh b/tests/find/type_list.sh
index 06c5c8b4..0165806d 100755
--- a/tests/find/type_list.sh
+++ b/tests/find/type_list.sh
@@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
-print_ver_ find oldfind
+print_ver_ find
# This test is in 'all_root_tests' to get better coverage for file types a
# regular user cannot create. Still, it is run during 'make check' as well.
@@ -116,175 +116,171 @@ make_test_data dir \
find dir -mindepth 1 -ls
fail=0
-for exe in find oldfind; do
-
- # Negative tests first. Expect the output to be empty.
- > exp
-
- # Ensure empty type arguments are rejected.
- returns_ 1 "${exe}" dir -mindepth 1 -type '' > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Arguments to -type should contain at least one letter' err \
- || { cat err; fail=1; }
-
- returns_ 1 "${exe}" dir -mindepth 1 -xtype '' > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Arguments to -xtype should contain at least one letter' err \
- || { cat err; fail=1; }
-
- # Ensure non-separated type arguments are rejected.
- returns_ 1 "${exe}" dir -mindepth 1 -type fd > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Must separate multiple arguments to -type' err \
- || { cat err; fail=1; }
-
- returns_ 1 "${exe}" dir -mindepth 1 -xtype fd > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Must separate multiple arguments to -xtype' err \
- || { cat err; fail=1; }
-
- # Ensure unterminated type list arguments are rejected.
- returns_ 1 "${exe}" dir -mindepth 1 -type f, > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Last file type in list argument to -type is missing' err \
- || { cat err; fail=1; }
-
- returns_ 1 "${exe}" dir -mindepth 1 -xtype f, > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Last file type in list argument to -xtype is missing' err \
- || { cat err; fail=1; }
-
- # Ensure duplicate entries in the type list arguments are rejected.
- returns_ 1 "${exe}" dir -mindepth 1 -type f,f > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Duplicate file type .* in the argument list to -type' err \
- || { cat err; fail=1; }
-
- returns_ 1 "${exe}" dir -mindepth 1 -xtype f,f > out 2> err || fail=1
- compare exp out || fail=1
- grep 'Duplicate file type .* in the argument list to -xtype' err \
- || { cat err; fail=1; }
-
- # Continue with positive tests.
- # Files only
- grep -e '/reg$' all > exp
- "${exe}" dir -type f > out || fail=1
+
+# Negative tests first. Expect the output to be empty.
+> exp
+
+# Ensure empty type arguments are rejected.
+returns_ 1 find dir -mindepth 1 -type '' > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Arguments to -type should contain at least one letter' err \
+ || { cat err; fail=1; }
+
+returns_ 1 find dir -mindepth 1 -xtype '' > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Arguments to -xtype should contain at least one letter' err \
+ || { cat err; fail=1; }
+
+# Ensure non-separated type arguments are rejected.
+returns_ 1 find dir -mindepth 1 -type fd > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Must separate multiple arguments to -type' err \
+ || { cat err; fail=1; }
+
+returns_ 1 find dir -mindepth 1 -xtype fd > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Must separate multiple arguments to -xtype' err \
+ || { cat err; fail=1; }
+
+# Ensure unterminated type list arguments are rejected.
+returns_ 1 find dir -mindepth 1 -type f, > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Last file type in list argument to -type is missing' err \
+ || { cat err; fail=1; }
+
+returns_ 1 find dir -mindepth 1 -xtype f, > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Last file type in list argument to -xtype is missing' err \
+ || { cat err; fail=1; }
+
+# Ensure duplicate entries in the type list arguments are rejected.
+returns_ 1 find dir -mindepth 1 -type f,f > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Duplicate file type .* in the argument list to -type' err \
+ || { cat err; fail=1; }
+
+returns_ 1 find dir -mindepth 1 -xtype f,f > out 2> err || fail=1
+compare exp out || fail=1
+grep 'Duplicate file type .* in the argument list to -xtype' err \
+ || { cat err; fail=1; }
+
+# Continue with positive tests.
+# Files only
+grep -e '/reg$' all > exp
+find dir -type f > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+# Symbolic links only.
+if [ $HAVE_LINK = 1 ]; then
+ grep -e 'link$' all > exp
+ find dir -type l > out || fail=1
sort -o out out
compare exp out || fail=1;
- # Symbolic links only.
- if [ $HAVE_LINK = 1 ]; then
-
- grep -e 'link$' all > exp
- "${exe}" dir -type l > out || fail=1
- sort -o out out
- compare exp out || fail=1;
-
- grep -e 'dangling-link$' all > exp
- "${exe}" dir -xtype l > out || fail=1
- sort -o out out
- compare exp out || fail=1;
- fi
-
- # Files and directories.
- grep -e '/reg$' -e '/dir$' all > exp
- "${exe}" dir -mindepth 1 -type f,d > out || fail=1
+ grep -e 'dangling-link$' all > exp
+ find dir -xtype l > out || fail=1
sort -o out out
compare exp out || fail=1;
-
- grep -e '/reg' -e '/dir' all > exp
- "${exe}" dir -mindepth 1 -xtype f,d > out || fail=1
+fi
+
+# Files and directories.
+grep -e '/reg$' -e '/dir$' all > exp
+find dir -mindepth 1 -type f,d > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+grep -e '/reg' -e '/dir' all > exp
+find dir -mindepth 1 -xtype f,d > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+# Block devices.
+grep -e '/reg$' -e '/dir$' -e '/blk$' all > exp
+find dir -mindepth 1 -type b,f,d > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+grep -e '/reg' -e '/dir' -e '/blk' all > exp
+find dir -mindepth 1 -xtype b,f,d > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+# Character devices.
+grep -e '/reg$' -e '/dir$' -e '/chr$' all > exp
+find dir -mindepth 1 -type f,c,d > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+grep -e '/reg' -e '/dir' -e '/chr' all > exp
+find dir -mindepth 1 -xtype f,c,d > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+# FIFOs.
+if [ $HAVE_FIFO = 1 ]; then
+ grep -e '/reg$' -e '/dir$' -e '/fifo$' all > exp
+ find dir -mindepth 1 -type f,d,p > out || fail=1
sort -o out out
compare exp out || fail=1;
- # Block devices.
- grep -e '/reg$' -e '/dir$' -e '/blk$' all > exp
- "${exe}" dir -mindepth 1 -type b,f,d > out || fail=1
+ grep -e '/reg' -e '/dir' -e '/fifo' all > exp
+ find dir -mindepth 1 -xtype f,d,p > out || fail=1
sort -o out out
compare exp out || fail=1;
+fi
- grep -e '/reg' -e '/dir' -e '/blk' all > exp
- "${exe}" dir -mindepth 1 -xtype b,f,d > out || fail=1
+# Sockets.
+if [ $HAVE_SOCK = 1 ]; then
+ grep -e '/reg$' -e '/dir$' -e '/sock$' all > exp
+ find dir -mindepth 1 -type f,d,s > out || fail=1
sort -o out out
compare exp out || fail=1;
- # Character devices.
- grep -e '/reg$' -e '/dir$' -e '/chr$' all > exp
- "${exe}" dir -mindepth 1 -type f,c,d > out || fail=1
+ grep -e '/reg' -e '/dir' -e '/sock' all > exp
+ find dir -mindepth 1 -xtype f,d,s > out || fail=1
sort -o out out
compare exp out || fail=1;
+fi
- grep -e '/reg' -e '/dir' -e '/chr' all > exp
- "${exe}" dir -mindepth 1 -xtype f,c,d > out || fail=1
+# Symbolic links.
+if [ $HAVE_LINK = 1 ]; then
+ grep -e '/reg$' -e 'link$' all > exp
+ find dir -mindepth 1 -type f,l > out || fail=1
sort -o out out
compare exp out || fail=1;
- # FIFOs.
- if [ $HAVE_FIFO = 1 ]; then
- grep -e '/reg$' -e '/dir$' -e '/fifo$' all > exp
- "${exe}" dir -mindepth 1 -type f,d,p > out || fail=1
- sort -o out out
- compare exp out || fail=1;
-
- grep -e '/reg' -e '/dir' -e '/fifo' all > exp
- "${exe}" dir -mindepth 1 -xtype f,d,p > out || fail=1
- sort -o out out
- compare exp out || fail=1;
- fi
-
- # Sockets.
- if [ $HAVE_SOCK = 1 ]; then
- grep -e '/reg$' -e '/dir$' -e '/sock$' all > exp
- "${exe}" dir -mindepth 1 -type f,d,s > out || fail=1
- sort -o out out
- compare exp out || fail=1;
-
- grep -e '/reg' -e '/dir' -e '/sock' all > exp
- "${exe}" dir -mindepth 1 -xtype f,d,s > out || fail=1
- sort -o out out
- compare exp out || fail=1;
- fi
-
- # Symbolic links.
- if [ $HAVE_LINK = 1 ]; then
-
- grep -e '/reg$' -e 'link$' all > exp
- "${exe}" dir -mindepth 1 -type f,l > out || fail=1
- sort -o out out
- compare exp out || fail=1;
-
- grep -e '/reg' -e 'dangling-link$' all > exp
- "${exe}" dir -mindepth 1 -xtype f,l > out || fail=1
- sort -o out out
- compare exp out || fail=1;
- fi
-
- # -xtype: all but the dangling symlink.
- t='f,d,b,c'
- [ $HAVE_FIFO = 1 ] && t="$t,p"
- [ $HAVE_SOCK = 1 ] && t="$t,s"
- [ $HAVE_DOOR = 1 ] && t="$t,D"
- grep -v 'dangling-link$' all > exp
- "${exe}" dir -mindepth 1 -xtype "$t" > out || fail=1
+ grep -e '/reg' -e 'dangling-link$' all > exp
+ find dir -mindepth 1 -xtype f,l > out || fail=1
sort -o out out
compare exp out || fail=1;
-
- # negation
- if [ $HAVE_LINK = 1 ]; then
- "${exe}" dir -mindepth 1 -not -xtype l > out || fail=1
- sort -o out out
- compare exp out || fail=1;
- fi
-
- # Finally: full list
- [ $HAVE_LINK = 1 ] && t="$t,l"
- "${exe}" dir -mindepth 1 -type "$t" > out || fail=1
+fi
+
+# -xtype: all but the dangling symlink.
+t='f,d,b,c'
+[ $HAVE_FIFO = 1 ] && t="$t,p"
+[ $HAVE_SOCK = 1 ] && t="$t,s"
+[ $HAVE_DOOR = 1 ] && t="$t,D"
+grep -v 'dangling-link$' all > exp
+find dir -mindepth 1 -xtype "$t" > out || fail=1
+sort -o out out
+compare exp out || fail=1;
+
+# negation
+if [ $HAVE_LINK = 1 ]; then
+ find dir -mindepth 1 -not -xtype l > out || fail=1
sort -o out out
- compare all out || fail=1;
+ compare exp out || fail=1;
+fi
- "${exe}" dir -mindepth 1 -xtype "$t" > out || fail=1
- sort -o out out
- compare all out || fail=1;
-done
+# Finally: full list
+[ $HAVE_LINK = 1 ] && t="$t,l"
+find dir -mindepth 1 -type "$t" > out || fail=1
+sort -o out out
+compare all out || fail=1;
+
+find dir -mindepth 1 -xtype "$t" > out || fail=1
+sort -o out out
+compare all out || fail=1;
Exit $fail