[PATCH 1 of 2] testsuite: add (currently failing) test for -r on symlink to dir

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Jul 29 08:45:12 UTC 2014


'grep -r' on a symbolic link to a directory should follow the link.
This patch adds a test to the testsuite to verify this, which currently
fails due to grep not handling this case.
A subsequent patch will actually fix the behavior of grep.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>

---
Note: I split the test from the fix to simplify verification of these
patches. If you prefer, I can fold both patches into one.

 testsuite/grep.tests |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff -r eba45f111886 -r 66406add5e60 testsuite/grep.tests
--- a/testsuite/grep.tests	Mon Jul 21 14:14:24 2014 +0300
+++ b/testsuite/grep.tests	Mon Jul 28 16:33:41 2014 +0200
@@ -171,6 +171,14 @@
 	"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
+
 # 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


More information about the busybox mailing list