summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko2014-08-28 15:50:09 +0200
committerDenys Vlasenko2014-08-28 15:50:09 +0200
commit34cc6c91a286411a8275d9d61aa80397fe1e5fa3 (patch)
tree2808db0f61e5e63dc390330c98ce5acd7cefea9a /testsuite
parent6ff055115798166e172039284448be758b04e195 (diff)
downloadbusybox-34cc6c91a286411a8275d9d61aa80397fe1e5fa3.zip
busybox-34cc6c91a286411a8275d9d61aa80397fe1e5fa3.tar.gz
grep: fix "grep -r PATTRN SYMLINK_TO_DIR"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/grep.tests20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/grep.tests b/testsuite/grep.tests
index 323b384..f6d9f21 100755
--- a/testsuite/grep.tests
+++ b/testsuite/grep.tests
@@ -171,6 +171,26 @@ testing "grep -w word match second word" \
"bword,word\n""wordb,word\n""bwordb,word\n" \
""
+# -r on symlink to dir should recurse into dir
+mkdir -p grep.testdir/foo
+echo bar > grep.testdir/foo/file
+ln -s foo grep.testdir/symfoo
+testing "grep -r on symlink to dir" \
+ "grep -r . grep.testdir/symfoo" \
+ "grep.testdir/symfoo/file:bar\n" \
+ "" ""
+rm -Rf grep.testdir
+
+# But -r on dir/symlink_to_dir should not recurse into symlink_to_dir
+mkdir -p grep.testdir/foo
+echo bar > grep.testdir/foo/file
+ln -s foo grep.testdir/symfoo
+testing "grep -r on dir/symlink to dir" \
+ "grep -r . grep.testdir" \
+ "grep.testdir/foo/file:bar\n" \
+ "" ""
+rm -Rf grep.testdir
+
# testing "test name" "commands" "expected result" "file input" "stdin"
# file input will be file called "input"
# test can create a file "actual" instead of writing to stdout