Remove no-longer-used svn_*_get_mergeinfo_for_tree APIs.
[svn.git] / subversion / tests / cmdline / svnserveautocheck.sh
blob7406803527984fdc2f3557b5d08cfa1f0f034317
1 #!/bin/bash
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)
16 SCRIPT=$(basename $0)
18 set +e
20 trap trap_cleanup SIGHUP SIGTERM SIGINT
22 function really_cleanup() {
23 if [ -e "$SVNSERVE_PID" ]; then
24 kill $(cat "$SVNSERVE_PID")
25 rm -f $SVNSERVE_PID
29 function trap_cleanup() {
30 really_cleanup
31 exit 1
34 function say() {
35 echo "$SCRIPT: $*"
38 function fail() {
39 say $*
40 exit 1
43 if [ -x subversion/svn/svn ]; then
44 ABS_BUILDDIR=$(pwd)
45 elif [ -x $SCRIPTDIR/../../svn/svn ]; then
46 pushd $SCRIPTDIR/../../../ >/dev/null
47 ABS_BUILDDIR=$(pwd)
48 popd >/dev/null
49 else
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"
61 rm -f $SVNSERVE_PID
63 SVNSERVE_PORT=$(($RANDOM+1024))
64 while netstat -an | grep $SVNSERVE_PORT | grep 'LISTEN'; do
65 SVNSERVE_PORT=$(($RANDOM+1024))
66 done
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
74 if [ $# == 0 ]; then
75 time make check "BASE_URL=$BASE_URL"
76 r=$?
77 else
78 pushd "$ABS_BUILDDIR/subversion/tests/cmdline/" >/dev/null
79 TEST="$1"
80 shift
81 time "./${TEST}_tests.py" "--url=$BASE_URL" $*
82 r=$?
83 popd >/dev/null
86 really_cleanup
87 exit $r