2 # -*- mode: shell-script; -*-
4 # This script simplifies the preparation of the environment for a Subversion client
5 # communicating with an svnserve server.
7 # The script runs svnserve, runs "make check", and kills the svnserve afterwards.
8 # It makes sure to kill the svnserve even if the test run dies.
10 # This script should be run from the top level of the Subversion
11 # distribution; it's easiest to just run it as "make
12 # svnserveautocheck". Like "make check", you can specify further options
13 # like "make svnserveautocheck FS_TYPE=bdb TESTS=subversion/tests/cmdline/basic.py".
15 SCRIPTDIR
=$
(dirname $0)
20 trap trap_cleanup SIGHUP SIGTERM SIGINT
22 function really_cleanup
() {
23 if [ -e "$SVNSERVE_PID" ]; then
24 kill $
(cat "$SVNSERVE_PID")
29 function trap_cleanup
() {
43 if [ -x subversion
/svn
/svn
]; then
45 elif [ -x $SCRIPTDIR/..
/..
/svn
/svn
]; then
46 pushd $SCRIPTDIR/..
/..
/..
/ >/dev
/null
50 fail
"Run this script from the root of Subversion's build tree!"
53 # If you change this, also make sure to change the svn:ignore entry
54 # for it and "make check-clean".
55 SVNSERVE_PID
=$ABS_BUILDDIR/subversion
/tests
/svnserveautocheck.pid
57 export LD_LIBRARY_PATH
="$ABS_BUILDDIR/subversion/libsvn_ra_neon/.libs:$ABS_BUILDDIR/subversion/libsvn_ra_local/.libs:$ABS_BUILDDIR/subversion/libsvn_ra_svn/.libs"
59 SERVER_CMD
="$ABS_BUILDDIR/subversion/svnserve/svnserve"
63 SVNSERVE_PORT
=$
(($RANDOM+1024))
64 while netstat
-an |
grep $SVNSERVE_PORT |
grep 'LISTEN'; do
65 SVNSERVE_PORT
=$
(($RANDOM+1024))
68 "$SERVER_CMD" -d -r "$ABS_BUILDDIR/subversion/tests/cmdline" \
69 --listen-host 127.0.0.1 \
70 --listen-port $SVNSERVE_PORT \
71 --pid-file $SVNSERVE_PID &
73 BASE_URL
=svn
://127.0.0.1:$SVNSERVE_PORT
75 time make check
"BASE_URL=$BASE_URL"
78 pushd "$ABS_BUILDDIR/subversion/tests/cmdline/" >/dev
/null
81 time "./${TEST}_tests.py" "--url=$BASE_URL" $
*