|
|
34457c |
From aa5105dc115b43edc6c9c11714b092583f1221aa Mon Sep 17 00:00:00 2001
|
|
|
34457c |
From: Todd Zullinger <tmz@pobox.com>
|
|
|
34457c |
Date: Fri, 26 Aug 2022 18:28:44 -0400
|
|
|
34457c |
Subject: [PATCH] t/lib-git-svn: try harder to find a port
|
|
|
34457c |
|
|
|
34457c |
As with the previous commits, try harder to find an open port to avoid
|
|
|
34457c |
intermittent failures on busy/shared build systems.
|
|
|
34457c |
|
|
|
34457c |
By default, we make 3 attempts. This may be overridden by setting
|
|
|
34457c |
GIT_TEST_START_SVNSERVE_TRIES to a different value.
|
|
|
34457c |
|
|
|
34457c |
Run svnserve in daemon mode and use 'test_atexit' to stop it. This is
|
|
|
34457c |
cleaner than running in the foreground with --listen-once and having to
|
|
|
34457c |
manage the PID ourselves.
|
|
|
34457c |
|
|
|
34457c |
Signed-off-by: Todd Zullinger <tmz@pobox.com>
|
|
|
34457c |
---
|
|
|
34457c |
t/lib-git-svn.sh | 34 +++++++++++++++++++++++++----
|
|
|
34457c |
t/t9113-git-svn-dcommit-new-file.sh | 1 -
|
|
|
34457c |
2 files changed, 30 insertions(+), 5 deletions(-)
|
|
|
34457c |
|
|
|
34457c |
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
|
|
|
34457c |
index ea28971e8e..04e660e2ba 100644
|
|
|
34457c |
--- a/t/lib-git-svn.sh
|
|
|
34457c |
+++ b/t/lib-git-svn.sh
|
|
|
34457c |
@@ -17,6 +17,7 @@ fi
|
|
|
34457c |
GIT_DIR=$PWD/.git
|
|
|
34457c |
GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn
|
|
|
34457c |
SVN_TREE=$GIT_SVN_DIR/svn-tree
|
|
|
34457c |
+SVNSERVE_PIDFILE="$PWD"/daemon.pid
|
|
|
34457c |
test_set_port SVNSERVE_PORT
|
|
|
34457c |
|
|
|
34457c |
svn >/dev/null 2>&1
|
|
|
34457c |
@@ -119,10 +120,35 @@ require_svnserve () {
|
|
|
34457c |
}
|
|
|
34457c |
|
|
|
34457c |
start_svnserve () {
|
|
|
34457c |
- svnserve --listen-port $SVNSERVE_PORT \
|
|
|
34457c |
- --root "$rawsvnrepo" \
|
|
|
34457c |
- --listen-once \
|
|
|
34457c |
- --listen-host 127.0.0.1 &
|
|
|
34457c |
+ test_atexit stop_svnserve
|
|
|
34457c |
+
|
|
|
34457c |
+ i=0
|
|
|
34457c |
+ while test $i -lt ${GIT_TEST_START_SVNSERVE_TRIES:-3}
|
|
|
34457c |
+ do
|
|
|
34457c |
+ say >&3 "Starting svnserve on port $SVNSERVE_PORT ..."
|
|
|
34457c |
+ svnserve --listen-port $SVNSERVE_PORT \
|
|
|
34457c |
+ --root "$rawsvnrepo" \
|
|
|
34457c |
+ --daemon --pid-file="$SVNSERVE_PIDFILE" \
|
|
|
34457c |
+ --listen-host 127.0.0.1
|
|
|
34457c |
+ ret=$?
|
|
|
34457c |
+ # increment port and retry if unsuccessful
|
|
|
34457c |
+ if test $ret -ne 0
|
|
|
34457c |
+ then
|
|
|
34457c |
+ SVNSERVE_PORT=$(($SVNSERVE_PORT + 1))
|
|
|
34457c |
+ export SVNSERVE_PORT
|
|
|
34457c |
+ else
|
|
|
34457c |
+ break
|
|
|
34457c |
+ fi
|
|
|
34457c |
+ done
|
|
|
34457c |
+}
|
|
|
34457c |
+
|
|
|
34457c |
+stop_svnserve () {
|
|
|
34457c |
+ say >&3 "Stopping svnserve ..."
|
|
|
34457c |
+ SVNSERVE_PID="$(cat "$SVNSERVE_PIDFILE")"
|
|
|
34457c |
+ if test -n "$SVNSERVE_PID"
|
|
|
34457c |
+ then
|
|
|
34457c |
+ kill "$SVNSERVE_PID" 2>/dev/null
|
|
|
34457c |
+ fi
|
|
|
34457c |
}
|
|
|
34457c |
|
|
|
34457c |
prepare_utf8_locale () {
|
|
|
34457c |
diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh
|
|
|
34457c |
index e8479cec7a..5925891f5d 100755
|
|
|
34457c |
--- a/t/t9113-git-svn-dcommit-new-file.sh
|
|
|
34457c |
+++ b/t/t9113-git-svn-dcommit-new-file.sh
|
|
|
34457c |
@@ -28,7 +28,6 @@ test_expect_success 'create files in new directory with dcommit' "
|
|
|
34457c |
echo hello > git-new-dir/world &&
|
|
|
34457c |
git update-index --add git-new-dir/world &&
|
|
|
34457c |
git commit -m hello &&
|
|
|
34457c |
- start_svnserve &&
|
|
|
34457c |
git svn dcommit
|
|
|
34457c |
"
|
|
|
34457c |
|