t/lib-git-svn.sh: improve svnserve tests with parallel make test
authorTodd Zullinger <tmz@pobox.com>
Fri, 1 Dec 2017 15:56:53 +0000 (10:56 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Dec 2017 18:41:55 +0000 (10:41 -0800)
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
index 84366b262402c8eb38404e292b4a2fcd35e1ea5e..4c1f81f1678d83ab8b9ee7704d400bdd47ea70f7 100644 (file)
@@ -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 \