Annotation of ircnowd/src/testsuite/start-server.sh, Revision 1.1.1.1
1.1 tomglok 1: #!/bin/sh
2: # ngIRCd Test Suite
3:
4: [ -z "$srcdir" ] && srcdir=`dirname $0`
5:
6: # read in functions
7: . ${srcdir}/functions.inc
8:
9: if [ -n "$1" ]; then
10: id="$1"; shift
11: else
12: id="1"
13: fi
14:
15: echo_n "starting server ${id} ..."
16:
17: # remove old logfiles, if this is the first server (ID 1)
18: [ "$id" = "1" ] && rm -rf logs *.log
19:
20: # check weather getpid.sh returns valid PIDs. If not, don't start up the
21: # test-server, because we won't be able to kill it at the end of the test.
22: ./getpid.sh sh > /dev/null 2>&1
23: if [ $? -ne 0 ]; then
24: echo " getpid.sh failed!"
25: exit 1
26: fi
27:
28: # check if there is a test-server already running
29: ./getpid.sh T-ngircd${id} >/dev/null 2>&1
30: if [ $? -eq 0 ]; then
31: echo " failure: test-server ${id} already running!"
32: exit 1
33: fi
34:
35: # generate MOTD for test-server
36: echo "This is an ngIRCd Test Server" > ngircd-test${id}.motd
37:
38: # glibc memory checking, see malloc(3)
39: MALLOC_CHECK_=3
40: export MALLOC_CHECK_
41:
42: # starting up test-server ...
43: ./T-ngircd${id} -n -f ${srcdir}/ngircd-test${id}.conf $* \
44: >ngircd-test${id}.log 2>&1 &
45: sleep 1
46:
47: # validate running test-server
48: pid=`./getpid.sh T-ngircd${id}`
49: [ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$?
50:
51: [ $r -eq 0 ] && echo " ok." || echo " failure!"
52: exit $r
53:
54: # -eof-
CVSweb