aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-08-28 14:37:50 -0700
committerRob Landley <rob@landley.net>2019-08-28 17:57:40 -0500
commitf97f4e72e9ead6dcd0f747d5c780c0878b873e7f (patch)
tree01e3c47fb52505aa3370cb13671e72d02acdfbbc /tests
parentac84e8507983f9dee1df75bdd961a7dfd4f44b09 (diff)
downloadtoybox-f97f4e72e9ead6dcd0f747d5c780c0878b873e7f.tar.gz
Fix find(1) after c26870dab346.
Unlike ls, find does treat ENOENT specially. Add an extra test (and fix the behavior) for the case of ENOENT for a path provided on the command line --- unlike other ENOENT cases (typically dangling symlinks), ENOENT for a command line argument should report an error. Also remove obsolete `|sed` from the symlink loop test.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/find.test8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/find.test b/tests/find.test
index fea6a3fc..b3e2c4fa 100755
--- a/tests/find.test
+++ b/tests/find.test
@@ -102,18 +102,24 @@ testing "-printf" "find dir -name file -printf '%f %p %P %s'" \
"file dir/file file 0" "" ""
testing "-printf .N" "find dir -name file -printf %.2f" "fi" "" ""
+# No error message for a dangling link.
ln -s does-not-exist dir/dangler
testing "-L dangling symlink silent" \
"LANG=C find -L dir -name file 2>&1" "dir/file\n" "" ""
rm -f dir/dangler
+# An error for a symlink loop.
ln -s looper dir/looper
testing "-L symlink loop noisy" \
- "LANG=C find -L dir -name file 2>err | sed s/\'//g ; grep -q dir/looper err || echo missing error" \
+ "LANG=C find -L dir -name file 2>err ; grep -q dir/looper err || echo missing error" \
"dir/file\n" "" ""
rm -f dir/looper err
testing "-false" "find dir -false" "" "" ""
testing "-true" "find dir/file -true" "dir/file\n" "" ""
+testing "missing root error" \
+ "LANG=C find -L dir/missing-root 2>err ; grep -q dir/missing-root err || echo missing error" \
+ "" "" ""
+
rm -rf dir