cgit

commit 392e07d28a23aec9942b9ed0d122e35d2d268fb9

Author: John Keeping <john@keeping.me.uk>

tests: "grep -e" is not portable to all platforms

The "-e" option to grep is not needed unless specifying more than one
pattern, which we don't do.  Remove it to avoid restricting the tests on
platforms that do not have a grep that recognises "-e".

Signed-off-by: John Keeping <john@keeping.me.uk>

 tests/t0101-index.sh | 18 +++++++++---------
 tests/t0102-summary.sh | 22 +++++++++++-----------
 tests/t0103-log.sh | 20 ++++++++++----------
 tests/t0104-tree.sh | 12 ++++++------
 tests/t0105-commit.sh | 12 ++++++------
 tests/t0106-diff.sh | 10 +++++-----
 tests/t0107-snapshot.sh | 6 +++---
 tests/t0108-patch.sh | 10 +++++-----


diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh
index 573a351b8078193563f26f22888b6f1a90f7ab78..ab63aca97150e77fd0128ca8ceaba1a7341e1bc4 100755
--- a/tests/t0101-index.sh
+++ b/tests/t0101-index.sh
@@ -5,14 +5,14 @@
 prepare_tests "Check content on index page"
 
 run_test 'generate index page' 'cgit_url "" >trash/tmp'
-run_test 'find foo repo' 'grep -e "foo" trash/tmp'
-run_test 'find foo description' 'grep -e "\[no description\]" trash/tmp'
-run_test 'find bar repo' 'grep -e "bar" trash/tmp'
-run_test 'find bar description' 'grep -e "the bar repo" trash/tmp'
-run_test 'find foo+bar repo' 'grep -e ">foo+bar<" trash/tmp'
-run_test 'verify foo+bar link' 'grep -e "/foo+bar/" trash/tmp'
-run_test 'verify "with%20space" link' 'grep -e "/with%20space/" trash/tmp'
-run_test 'no tree-link' '! grep -e "foo/tree" trash/tmp'
-run_test 'no log-link' '! grep -e "foo/log" trash/tmp'
+run_test 'find foo repo' 'grep "foo" trash/tmp'
+run_test 'find foo description' 'grep "\[no description\]" trash/tmp'
+run_test 'find bar repo' 'grep "bar" trash/tmp'
+run_test 'find bar description' 'grep "the bar repo" trash/tmp'
+run_test 'find foo+bar repo' 'grep ">foo+bar<" trash/tmp'
+run_test 'verify foo+bar link' 'grep "/foo+bar/" trash/tmp'
+run_test 'verify "with%20space" link' 'grep "/with%20space/" trash/tmp'
+run_test 'no tree-link' '! grep "foo/tree" trash/tmp'
+run_test 'no log-link' '! grep "foo/log" trash/tmp'
 
 tests_done




diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh
index f299c5a4d4440b1b1d66519f16828c8754505f1c..f778cb49d30a341d062270926be987f3cc1bc0e8 100755
--- a/tests/t0102-summary.sh
+++ b/tests/t0102-summary.sh
@@ -5,22 +5,22 @@
 prepare_tests "Check content on summary page"
 
 run_test 'generate foo summary' 'cgit_url "foo" >trash/tmp'
-run_test 'find commit 1' 'grep -e "commit 1" trash/tmp'
-run_test 'find commit 5' 'grep -e "commit 5" trash/tmp'
-run_test 'find branch master' 'grep -e "master" trash/tmp'
-run_test 'no tags' '! grep -e "tags" trash/tmp'
+run_test 'find commit 1' 'grep "commit 1" trash/tmp'
+run_test 'find commit 5' 'grep "commit 5" trash/tmp'
+run_test 'find branch master' 'grep "master" trash/tmp'
+run_test 'no tags' '! grep "tags" trash/tmp'
 run_test 'clone-url expanded correctly' '
-	grep -e "git://example.org/foo.git" trash/tmp
+	grep "git://example.org/foo.git" trash/tmp
 '
 
 run_test 'generate bar summary' 'cgit_url "bar" >trash/tmp'
-run_test 'no commit 45' '! grep -e "commit 45" trash/tmp'
-run_test 'find commit 46' 'grep -e "commit 46" trash/tmp'
-run_test 'find commit 50' 'grep -e "commit 50" trash/tmp'
-run_test 'find branch master' 'grep -e "master" trash/tmp'
-run_test 'no tags' '! grep -e "tags" trash/tmp'
+run_test 'no commit 45' '! grep "commit 45" trash/tmp'
+run_test 'find commit 46' 'grep "commit 46" trash/tmp'
+run_test 'find commit 50' 'grep "commit 50" trash/tmp'
+run_test 'find branch master' 'grep "master" trash/tmp'
+run_test 'no tags' '! grep "tags" trash/tmp'
 run_test 'clone-url expanded correctly' '
-	grep -e "git://example.org/bar.git" trash/tmp
+	grep "git://example.org/bar.git" trash/tmp
 '
 
 tests_done




diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh
index 7fa6754de90fc7c3af1b7c0180acbdc9077a7380..67fcba01afc4bd8baf2b8bad0f10c0a91298a01b 100755
--- a/tests/t0103-log.sh
+++ b/tests/t0103-log.sh
@@ -5,21 +5,21 @@
 prepare_tests "Check content on log page"
 
 run_test 'generate foo/log' 'cgit_url "foo/log" >trash/tmp'
-run_test 'find commit 1' 'grep -e "commit 1" trash/tmp'
-run_test 'find commit 5' 'grep -e "commit 5" trash/tmp'
+run_test 'find commit 1' 'grep "commit 1" trash/tmp'
+run_test 'find commit 5' 'grep "commit 5" trash/tmp'
 
 run_test 'generate bar/log' 'cgit_url "bar/log" >trash/tmp'
-run_test 'find commit 1' 'grep -e "commit 1" trash/tmp'
-run_test 'find commit 50' 'grep -e "commit 50" trash/tmp'
+run_test 'find commit 1' 'grep "commit 1" trash/tmp'
+run_test 'find commit 50' 'grep "commit 50" trash/tmp'
 
 run_test 'generate "with%20space/log?qt=grep&q=commit+1"' '
 	cgit_url "with+space/log&qt=grep&q=commit+1" >trash/tmp
 '
-run_test 'find commit 1' 'grep -e "commit 1" trash/tmp'
-run_test 'find link with %20 in path' 'grep -e "/with%20space/log/?qt=grep" trash/tmp'
-run_test 'find link with + in arg' 'grep -e "/log/?qt=grep&amp;q=commit+1" trash/tmp'
-run_test 'no links with space in path' '! grep -e "href=./with space/" trash/tmp'
-run_test 'no links with space in arg' '! grep -e "q=commit 1" trash/tmp'
-run_test 'commit 2 is not visible' '! grep -e "commit 2" trash/tmp'
+run_test 'find commit 1' 'grep "commit 1" trash/tmp'
+run_test 'find link with %20 in path' 'grep "/with%20space/log/?qt=grep" trash/tmp'
+run_test 'find link with + in arg' 'grep "/log/?qt=grep&amp;q=commit+1" trash/tmp'
+run_test 'no links with space in path' '! grep "href=./with space/" trash/tmp'
+run_test 'no links with space in arg' '! grep "q=commit 1" trash/tmp'
+run_test 'commit 2 is not visible' '! grep "commit 2" trash/tmp'
 
 tests_done




diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh
index 2ce1251cbf56d06cc0f940cb36bd18b4537c78ef..7aa3b8d6b565a4fc47fd089757955dddbce9a6d1 100755
--- a/tests/t0104-tree.sh
+++ b/tests/t0104-tree.sh
@@ -5,29 +5,29 @@
 prepare_tests "Check content on tree page"
 
 run_test 'generate bar/tree' 'cgit_url "bar/tree" >trash/tmp'
-run_test 'find file-1' 'grep -e "file-1" trash/tmp'
-run_test 'find file-50' 'grep -e "file-50" trash/tmp'
+run_test 'find file-1' 'grep "file-1" trash/tmp'
+run_test 'find file-50' 'grep "file-50" trash/tmp'
 
 run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp'
 
 run_test 'find line 1' '
-	grep -e "<a class=.no. id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp
+	grep "<a class=.no. id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp
 '
 
 run_test 'no line 2' '
-	! grep -e "<a class=.no. id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
+	! grep "<a class=.no. id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
 '
 
 run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp'
 
 run_test 'verify a+b link' '
-	grep -e "/foo+bar/tree/a+b" trash/tmp
+	grep "/foo+bar/tree/a+b" trash/tmp
 '
 
 run_test 'generate foo+bar/tree?h=1+2' 'cgit_url "foo%2bbar/tree&h=1%2b2" >trash/tmp'
 
 run_test 'verify a+b?h=1+2 link' '
-	grep -e "/foo+bar/tree/a+b?h=1%2b2" trash/tmp
+	grep "/foo+bar/tree/a+b?h=1%2b2" trash/tmp
 '
 
 tests_done




diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
index ae794c88de0ae24cf13eed5d26ee69a06c2b3718..19a650b14a4cd8623f6dfbbb75bfb0ea58c26a0a 100755
--- a/tests/t0105-commit.sh
+++ b/tests/t0105-commit.sh
@@ -5,18 +5,18 @@
 prepare_tests "Check content on commit page"
 
 run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp'
-run_test 'find tree link' 'grep -e "<a href=./foo/tree/.>" trash/tmp'
+run_test 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp'
 run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp'
 
 run_test 'find commit subject' '
-	grep -e "<div class=.commit-subject.>commit 5<" trash/tmp
+	grep "<div class=.commit-subject.>commit 5<" trash/tmp
 '
 
-run_test 'find commit msg' 'grep -e "<div class=.commit-msg.></div>" trash/tmp'
-run_test 'find diffstat' 'grep -e "<table summary=.diffstat. class=.diffstat.>" trash/tmp'
+run_test 'find commit msg' 'grep "<div class=.commit-msg.></div>" trash/tmp'
+run_test 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" trash/tmp'
 
 run_test 'find diff summary' '
-	 grep -e "1 files changed, 1 insertions, 0 deletions" trash/tmp
+	 grep "1 files changed, 1 insertions, 0 deletions" trash/tmp
 '
 
 run_test 'get root commit' '
@@ -31,7 +31,7 @@ '
 
 run_test 'root commit contains diff' '
 	 grep ">diff --git a/file-1 b/file-1<" trash/tmp &&
-	 grep -e "<div class=.add.>+1</div>" trash/tmp
+	 grep "<div class=.add.>+1</div>" trash/tmp
 '
 
 tests_done




diff --git a/tests/t0106-diff.sh b/tests/t0106-diff.sh
index e140bcc32f9887c259d17d616db2c98bbe12d7d1..eee0c8c10ed7e373f102275b991e719ddac215b1 100755
--- a/tests/t0106-diff.sh
+++ b/tests/t0106-diff.sh
@@ -5,16 +5,16 @@
 prepare_tests "Check content on diff page"
 
 run_test 'generate foo/diff' 'cgit_url "foo/diff" >trash/tmp'
-run_test 'find diff header' 'grep -e "a/file-5 b/file-5" trash/tmp'
-run_test 'find blob link' 'grep -e "<a href=./foo/tree/file-5?id=" trash/tmp'
-run_test 'find added file' 'grep -e "new file mode 100644" trash/tmp'
+run_test 'find diff header' 'grep "a/file-5 b/file-5" trash/tmp'
+run_test 'find blob link' 'grep "<a href=./foo/tree/file-5?id=" trash/tmp'
+run_test 'find added file' 'grep "new file mode 100644" trash/tmp'
 
 run_test 'find hunk header' '
-	grep -e "<div class=.hunk.>@@ -0,0 +1 @@</div>" trash/tmp
+	grep "<div class=.hunk.>@@ -0,0 +1 @@</div>" trash/tmp
 '
 
 run_test 'find added line' '
-	grep -e "<div class=.add.>+5</div>" trash/tmp
+	grep "<div class=.add.>+5</div>" trash/tmp
 '
 
 tests_done




diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh
index 8ab4912a282b667fb19779138c7fe739acdfc321..8ad95737f193c7d182c53cbe2874336cce02219c 100755
--- a/tests/t0107-snapshot.sh
+++ b/tests/t0107-snapshot.sh
@@ -10,10 +10,10 @@ '
 
 run_test 'check html headers' '
 	head -n 1 trash/tmp |
-	     grep -e "Content-Type: application/x-gzip" &&
+	     grep "Content-Type: application/x-gzip" &&
 
 	head -n 2 trash/tmp |
-	     grep -e "Content-Disposition: inline; filename=.master.tar.gz."
+	     grep "Content-Disposition: inline; filename=.master.tar.gz."
 '
 
 run_test 'strip off the header lines' '
@@ -32,7 +32,7 @@ 	test $c = 5
 '
 
 run_test 'verify untarred file-5' '
-	 grep -e "^5$" trash/master/file-5 &&
+	 grep "^5$" trash/master/file-5 &&
 	 test $(cat trash/master/file-5 | wc -l) = 1
 '
 




diff --git a/tests/t0108-patch.sh b/tests/t0108-patch.sh
index 6ee70b31f7546ceecf7ab9b1dca1359955f0b8f6..f15c893b73738e7ec21e88602e656c201b4aeed7 100755
--- a/tests/t0108-patch.sh
+++ b/tests/t0108-patch.sh
@@ -9,19 +9,19 @@ 	cgit_query "url=foo/patch" >trash/tmp
 '
 
 run_test 'find `From:` line' '
-	grep -e "^From: " trash/tmp
+	grep "^From: " trash/tmp
 '
 
 run_test 'find `Date:` line' '
-	grep -e "^Date: " trash/tmp
+	grep "^Date: " trash/tmp
 '
 
 run_test 'find `Subject:` line' '
-	grep -e "^Subject: commit 5" trash/tmp
+	grep "^Subject: commit 5" trash/tmp
 '
 
 run_test 'find `cgit` signature' '
-	 tail -1 trash/tmp | grep -e "^cgit"
+	 tail -1 trash/tmp | grep "^cgit"
 '
 
 run_test 'find initial commit' '
@@ -33,7 +33,7 @@ 	cgit_query "url=foo/patch&id=$root" >trash/tmp
 '
 
 run_test 'find `cgit` signature' '
-	tail -1 trash/tmp | grep -e "^cgit"
+	tail -1 trash/tmp | grep "^cgit"
 '
 
 tests_done