# [PATCH v2 2/2] t/lib-git-svn.sh: improve svnserve tests with parallel make test

3 messages from 2017-12-01 to 2017-12-01. Participants: Todd Zullinger, Jonathan Nieder.
Thread: https://gitlist.dev/t/47360

## Todd Zullinger, 2017-12-01 15:56

Subject: [PATCH v2 2/2] t/lib-git-svn.sh: improve svnserve tests with parallel make test
Message-ID: <20171201155653.29553-2-tmz@pobox.com>
URL: https://gitlist.dev/e/20171201155653.29553-2-tmz%40pobox.com
In-Reply-To: <20171201155653.29553-1-tmz@pobox.com>

```
Setting SVNSERVE_PORT enables several tests which require a local
svnserve daemon to be run (in t9113 & t9126).  The tests share setup of
the local svnserve via `start_svnserve()`.  The function uses svnserve's
`--listen-once` option, which causes svnserve to accept one connection
on the port, serve it, and exit.  When running the tests in parallel
this fails if one test tries to start svnserve while the other is still
running.

Use the test number as the svnserve port (similar to httpd tests) to
avoid port conflicts.  Developers can set GIT_TEST_SVNSERVE to any value
other than 'false' or 'auto' to enable these tests.

Acked-by: Eric Wong <e@80x24.org>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
 t/lib-git-svn.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 84366b2624..4c1f81f167 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -110,14 +110,16 @@ EOF
 }
 
 require_svnserve () {
-	if test -z "$SVNSERVE_PORT"
+	test_tristate GIT_TEST_SVNSERVE
+	if ! test "$GIT_TEST_SVNSERVE" = true
 	then
-		skip_all='skipping svnserve test. (set $SVNSERVE_PORT to enable)'
+		skip_all='skipping svnserve test. (set $GIT_TEST_SVNSERVE to enable)'
 		test_done
 	fi
 }
 
 start_svnserve () {
+	SVNSERVE_PORT=${SVNSERVE_PORT-${this_test#t}}
 	svnserve --listen-port $SVNSERVE_PORT \
 		 --root "$rawsvnrepo" \
 		 --listen-once \
-- 
2.15.1


```

## Todd Zullinger, 2017-12-01 15:56

Subject: [PATCH v2 1/2] t/lib-git-svn: cleanup inconsistent tab/space usage
Message-ID: <20171201155653.29553-1-tmz@pobox.com>
URL: https://gitlist.dev/e/20171201155653.29553-1-tmz%40pobox.com
In-Reply-To: <20171201041133.GF3693@zaya.teonanacatl.net>

```
Acked-by: Eric Wong <e@80x24.org>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
 t/lib-git-svn.sh | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 688313ed5c..84366b2624 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -17,8 +17,8 @@ SVN_TREE=$GIT_SVN_DIR/svn-tree
 svn >/dev/null 2>&1
 if test $? -ne 1
 then
-    skip_all='skipping git svn tests, svn not found'
-    test_done
+	skip_all='skipping git svn tests, svn not found'
+	test_done
 fi
 
 svnrepo=$PWD/svnrepo
@@ -110,18 +110,18 @@ EOF
 }
 
 require_svnserve () {
-    if test -z "$SVNSERVE_PORT"
-    then
-	skip_all='skipping svnserve test. (set $SVNSERVE_PORT to enable)'
-        test_done
-    fi
+	if test -z "$SVNSERVE_PORT"
+	then
+		skip_all='skipping svnserve test. (set $SVNSERVE_PORT to enable)'
+		test_done
+	fi
 }
 
 start_svnserve () {
-    svnserve --listen-port $SVNSERVE_PORT \
-             --root "$rawsvnrepo" \
-             --listen-once \
-             --listen-host 127.0.0.1 &
+	svnserve --listen-port $SVNSERVE_PORT \
+		 --root "$rawsvnrepo" \
+		 --listen-once \
+		 --listen-host 127.0.0.1 &
 }
 
 prepare_a_utf8_locale () {
-- 
2.15.1


```

## Jonathan Nieder, 2017-12-01 20:06

Subject: Re: [PATCH v2 2/2] t/lib-git-svn.sh: improve svnserve tests with parallel make test
Message-ID: <20171201200613.GC18220@aiede.mtv.corp.google.com>
URL: https://gitlist.dev/e/20171201200613.GC18220%40aiede.mtv.corp.google.com
In-Reply-To: <20171201155653.29553-2-tmz@pobox.com>

```
Todd Zullinger wrote:

> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
> Signed-off-by: Todd Zullinger <tmz@pobox.com>
> ---
>  t/lib-git-svn.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

This and the previous one are indeed still
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks.

```
