X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Ftestsuite%2Fstart-server.sh;h=3d19ffb5997f795fe2dea8d0b421f6b87a49bf0d;hp=51de410ec4f2aa49e5bcd5ddda13f007153089c8;hb=6171beb7ab5dc0586581660852576f437470df63;hpb=fc6f64742cf58203c5e14481498e592d21899f02 diff --git a/src/testsuite/start-server.sh b/src/testsuite/start-server.sh index 51de410e..3d19ffb5 100755 --- a/src/testsuite/start-server.sh +++ b/src/testsuite/start-server.sh @@ -1,17 +1,54 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: start-server.sh,v 1.2 2002/09/09 22:56:07 alex Exp $ -echo " starting server ..." +[ -z "$srcdir" ] && srcdir=`dirname $0` -echo "This is an ngIRCd Test Server" > ngircd-test.motd +# read in functions +. ${srcdir}/functions.inc -../ngircd/ngircd -np -f ngircd-test.conf > ngircd-test.log 2>&1 & +if [ -n "$1" ]; then + id="$1"; shift +else + id="1" +fi + +echo_n "starting server ${id} ..." + +# remove old logfiles, if this is the first server (ID 1) +[ "$id" = "1" ] && rm -rf logs *.log + +# check weather getpid.sh returns valid PIDs. If not, don't start up the +# test-server, because we won't be able to kill it at the end of the test. +./getpid.sh sh > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo " getpid.sh failed!" + exit 1 +fi + +# check if there is a test-server already running +./getpid.sh T-ngircd${id} >/dev/null 2>&1 +if [ $? -eq 0 ]; then + echo " failure: test-server ${id} already running!" + exit 1 +fi + +# generate MOTD for test-server +echo "This is an ngIRCd Test Server" > ngircd-test${id}.motd + +# glibc memory checking, see malloc(3) +MALLOC_CHECK_=3 +export MALLOC_CHECK_ + +# starting up test-server ... +./T-ngircd${id} -n -f ${srcdir}/ngircd-test${id}.conf $* \ + >ngircd-test${id}.log 2>&1 & sleep 1 -pid=`ps a | grep ngircd-test | head -n 1 | cut -d ' ' -f 1` -kill -0 $pid > /dev/null 2>&1 +# validate running test-server +pid=`./getpid.sh T-ngircd${id}` +[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$? -rm -rf logs +[ $r -eq 0 ] && echo " ok." || echo " failure!" +exit $r # -eof-