Author: philip
Date: Wed Jun 10 12:04:21 2015
New Revision: 1684649
URL: http://svn.apache.org/r1684649
Log:
Support modern network utilities for finding free ports for tests
* subversion/tests/cmdline/davautocheck.sh:
Check for presence of ss, netstat and fail if neither is found.
Prefer ss to find a free port, fall back to netstat.
* subversion/tests/cmdline/svnserveautocheck.sh:
Same, and augment $PATH to include /usr/{,local/}sbin.
Patch by: Andreas Stieger <andreas.stieger{_AT_}gmx.de>
Modified:
subversion/trunk/subversion/tests/cmdline/davautocheck.sh
subversion/trunk/subversion/tests/cmdline/svnserveautocheck.sh
Modified: subversion/trunk/subversion/tests/cmdline/davautocheck.sh
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/davautocheck.sh?rev=1684649&r1=1684648&r2=1684649&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/davautocheck.sh (original)
+++ subversion/trunk/subversion/tests/cmdline/davautocheck.sh Wed Jun 10
12:04:21 2015
@@ -318,12 +318,18 @@ fi
# Stop any previous instances, os we can re-use the port.
if [ -x $STOPSCRIPT ]; then $STOPSCRIPT ; sleep 1; fi
+ss > /dev/null 2>&1 || netstat > /dev/null 2>&1 || fail "unable to find ss or
netstat required to find a free port"
+
HTTPD_PORT=3691
-while netstat -an | grep $HTTPD_PORT | grep 'LISTEN' >/dev/null; do
+while \
+ (ss -ltn sport = :$HTTPD_PORT 2>&1 | grep :$HTTPD_PORT > /dev/null ) \
+ || \
+ (netstat -an 2>&1 | grep $HTTPD_PORT | grep 'LISTEN' > /dev/null ) \
+ do
HTTPD_PORT=$(( HTTPD_PORT + 1 ))
if [ $HTTPD_PORT -eq 65536 ]; then
# Most likely the loop condition is true regardless of $HTTPD_PORT
- fail "netstat claims you have no free ports for httpd to listen on."
+ fail "ss/netstat claim you have no free ports for httpd to listen on."
fi
done
HTTPD_ROOT="$ABS_BUILDDIR/subversion/tests/cmdline/httpd-$(date
'+%Y%m%d-%H%M%S')"
Modified: subversion/trunk/subversion/tests/cmdline/svnserveautocheck.sh
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnserveautocheck.sh?rev=1684649&r1=1684648&r2=1684649&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnserveautocheck.sh (original)
+++ subversion/trunk/subversion/tests/cmdline/svnserveautocheck.sh Wed Jun 10
12:04:21 2015
@@ -95,9 +95,16 @@ random_port() {
if type time > /dev/null ; then TIME_CMD() { time "$@"; } ; else TIME_CMD() {
"$@"; } ; fi
MAKE=${MAKE:-make}
+PATH="$PATH:/usr/sbin/:/usr/local/sbin/"
+
+ss > /dev/null 2>&1 || netstat > /dev/null 2>&1 || fail "unable to find ss or
netstat required to find a free port"
SVNSERVE_PORT=$(random_port)
-while netstat -an | grep $SVNSERVE_PORT | grep 'LISTEN'; do
+while \
+ (ss -ltn sport = :$SVNSERVE_PORT 2>&1 | grep :$SVNSERVE_PORT > /dev/null ) \
+ || \
+ (netstat -an 2>&1 | grep $SVNSERVE_PORT | grep 'LISTEN' > /dev/null ) \
+ do
SVNSERVE_PORT=$(random_port)
done