t/lib-git-svn.sh: improve svnserve tests with parallel make test

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>

Todd Zullinger committed Dec 1, 2017 at 10:56 UTC bf9d7df950cd2c33b0e4e80386ba6140448a8a57
1 file changed +4 -2
t/lib-git-svn.sh
+4 -2
@@ -110,14 +110,16 @@ EOF
110 }
111
112 require_svnserve () {
113 - if test -z "$SVNSERVE_PORT"
113 + test_tristate GIT_TEST_SVNSERVE
114 + if ! test "$GIT_TEST_SVNSERVE" = true
115 then
115 - skip_all='skipping svnserve test. (set $SVNSERVE_PORT to enable)'
116 + skip_all='skipping svnserve test. (set $GIT_TEST_SVNSERVE to enable)'
117 test_done
118 fi
119 }
120
121 start_svnserve () {
122 + SVNSERVE_PORT=${SVNSERVE_PORT-${this_test#t}}
123 svnserve --listen-port $SVNSERVE_PORT \
124 --root "$rawsvnrepo" \
125 --listen-once \