List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 03/12] tests: remove prepare_tests
Date: Mon,  8 Apr 2013 20:12:32 +0100	[thread overview]
Message-ID: <8a8f386016f6b67380fbb8d6954d5942c4947c72.1365448308.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1365448308.git.john@keeping.me.uk>

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





  parent reply	other threads:[~2013-04-08 19:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 19:12 [PATCH 00/12] Test improvements john
2013-04-08 19:12 ` [PATCH 01/12] tests: use Git test functions directly john
2013-04-08 19:12 ` [PATCH 02/12] tests: don't let Git's test-lib create a repository john
2013-04-08 19:12 ` john [this message]
2013-04-08 19:12 ` [PATCH 04/12] t0001: don't setup test repositories john
2013-04-08 19:12 ` [PATCH 05/12] tests/.gitignore: update for using Git's test infrastructure john
2013-04-08 19:12 ` [PATCH 06/12] tests: remove "trash" directory john
2013-04-08 19:12 ` [PATCH 07/12] tests: put cgit onto $PATH john
2013-04-08 19:12 ` [PATCH 08/12] .gitignore: tighten cgit ignore expression john
2013-04-08 19:12 ` [PATCH 09/12] tests: add Valgrind support john
2013-04-08 19:23   ` Jason
2013-04-08 19:12 ` [PATCH 10/12] t0001: use test_cmp instead of 'diff -u' john
2013-04-08 19:12 ` [PATCH 11/12] tests: use test_line_count where appropriate john
2013-04-08 19:12 ` [PATCH 12/12] tests: use test_create_repo instead of "git init" john

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a8f386016f6b67380fbb8d6954d5942c4947c72.1365448308.git.john@keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).