[PATCH 03/12] tests: remove prepare_tests

John Keeping john at keeping.me.uk
Mon Apr 8 21:12:32 CEST 2013


Instead, setup the test repositories automatically.  Provide a variable
that can be used by tests to override this behaviour if they want.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 tests/setup.sh                       | 7 ++-----
 tests/t0001-validate-git-versions.sh | 2 --
 tests/t0010-validate-html.sh         | 2 --
 tests/t0020-validate-cache.sh        | 2 --
 tests/t0101-index.sh                 | 2 --
 tests/t0102-summary.sh               | 2 --
 tests/t0103-log.sh                   | 2 --
 tests/t0104-tree.sh                  | 2 --
 tests/t0105-commit.sh                | 2 --
 tests/t0106-diff.sh                  | 2 --
 tests/t0107-snapshot.sh              | 2 --
 tests/t0108-patch.sh                 | 2 --
 12 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/tests/setup.sh b/tests/setup.sh
index 1100449..962d96b 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -87,11 +87,6 @@ repo.desc=spaced repo
 EOF
 }
 
-prepare_tests()
-{
-	setup_repos
-}
-
 cgit_query()
 {
 	CGIT_CONFIG="$PWD/trash/cgitrc" QUERY_STRING="$1" "$PWD/../../cgit"
@@ -101,3 +96,5 @@ cgit_url()
 {
 	CGIT_CONFIG="$PWD/trash/cgitrc" QUERY_STRING="url=$1" "$PWD/../../cgit"
 }
+
+test -z "$CGIT_TEST_NO_CREATE_REPOS" && setup_repos
diff --git a/tests/t0001-validate-git-versions.sh b/tests/t0001-validate-git-versions.sh
index 02cb35a..61c2062 100755
--- a/tests/t0001-validate-git-versions.sh
+++ b/tests/t0001-validate-git-versions.sh
@@ -3,8 +3,6 @@
 test_description='Check Git version is correct'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'extract Git version from Makefile' '
 	sed -n -e "/^GIT_VER[ 	]*=/ {
 		s/^GIT_VER[ 	]*=[ 	]*//
diff --git a/tests/t0010-validate-html.sh b/tests/t0010-validate-html.sh
index 9cc0fdd..36d2ab6 100755
--- a/tests/t0010-validate-html.sh
+++ b/tests/t0010-validate-html.sh
@@ -22,8 +22,6 @@ test_url()
 	fi
 }
 
-prepare_tests
-
 tidy=`which tidy 2>/dev/null`
 test -n "$tidy" || {
 	skip_all='Skipping html validation tests: tidy not found'
diff --git a/tests/t0020-validate-cache.sh b/tests/t0020-validate-cache.sh
index 8be77e5..b6a12c7 100755
--- a/tests/t0020-validate-cache.sh
+++ b/tests/t0020-validate-cache.sh
@@ -3,8 +3,6 @@
 test_description='Validate cache'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'verify cache-size=0' '
 
 	rm -f trash/cache/* &&
diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh
index d4c4b19..69c92d1 100755
--- a/tests/t0101-index.sh
+++ b/tests/t0101-index.sh
@@ -3,8 +3,6 @@
 test_description='Check content on index page'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'generate index page' 'cgit_url "" >trash/tmp'
 test_expect_success 'find foo repo' 'grep "foo" trash/tmp'
 test_expect_success 'find foo description' 'grep "\[no description\]" trash/tmp'
diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh
index bfba6a0..470f89e 100755
--- a/tests/t0102-summary.sh
+++ b/tests/t0102-summary.sh
@@ -3,8 +3,6 @@
 test_description='Check content on summary page'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'generate foo summary' 'cgit_url "foo" >trash/tmp'
 test_expect_success 'find commit 1' 'grep "commit 1" trash/tmp'
 test_expect_success 'find commit 5' 'grep "commit 5" trash/tmp'
diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh
index 1d6ee05..ec873bc 100755
--- a/tests/t0103-log.sh
+++ b/tests/t0103-log.sh
@@ -3,8 +3,6 @@
 test_description='Check content on log page'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'generate foo/log' 'cgit_url "foo/log" >trash/tmp'
 test_expect_success 'find commit 1' 'grep "commit 1" trash/tmp'
 test_expect_success 'find commit 5' 'grep "commit 5" trash/tmp'
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh
index c0312ff..ecf96e6 100755
--- a/tests/t0104-tree.sh
+++ b/tests/t0104-tree.sh
@@ -3,8 +3,6 @@
 test_description='Check content on tree page'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'generate bar/tree' 'cgit_url "bar/tree" >trash/tmp'
 test_expect_success 'find file-1' 'grep "file-1" trash/tmp'
 test_expect_success 'find file-50' 'grep "file-50" trash/tmp'
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
index 6dee292..ae6bd94 100755
--- a/tests/t0105-commit.sh
+++ b/tests/t0105-commit.sh
@@ -3,8 +3,6 @@
 test_description='Check content on commit page'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp'
 test_expect_success 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp'
 test_expect_success 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp'
diff --git a/tests/t0106-diff.sh b/tests/t0106-diff.sh
index e629f62..427ad29 100755
--- a/tests/t0106-diff.sh
+++ b/tests/t0106-diff.sh
@@ -3,8 +3,6 @@
 test_description='Check content on diff page'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'generate foo/diff' 'cgit_url "foo/diff" >trash/tmp'
 test_expect_success 'find diff header' 'grep "a/file-5 b/file-5" trash/tmp'
 test_expect_success 'find blob link' 'grep "<a href=./foo/tree/file-5?id=" trash/tmp'
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh
index 35b6663..271cdb4 100755
--- a/tests/t0107-snapshot.sh
+++ b/tests/t0107-snapshot.sh
@@ -3,8 +3,6 @@
 test_description='Verify snapshot'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'get foo/snapshot/master.tar.gz' '
 	cgit_url "foo/snapshot/master.tar.gz" >trash/tmp
 '
diff --git a/tests/t0108-patch.sh b/tests/t0108-patch.sh
index 9296f6a..8bf6914 100755
--- a/tests/t0108-patch.sh
+++ b/tests/t0108-patch.sh
@@ -3,8 +3,6 @@
 test_description='Check content on patch page'
 . ./setup.sh
 
-prepare_tests
-
 test_expect_success 'generate foo/patch' '
 	cgit_query "url=foo/patch" >trash/tmp
 '
-- 
1.8.2.694.ga76e9c3.dirty





More information about the CGit mailing list