Renamed test0?.sh to stop0?.sh, added timing2
[idzebra-moved-to-github.git] / test / gils / stop02.sh
1 # test02.sh - test start and stop of the server with -S
2 #
3 # FIXME - this test does not currently pass  (H 22-oct-2002)
4 # Something rotten with signals and threads and mutexes...
5
6 echo "initializing"
7 mkdir -p reg
8 rm -f idx.log srv.log
9 ../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
10
11 #create a base to test on
12 ../../index/zebraidx -l idx.log -c zebra1.cfg update records  || exit 1
13
14 #kill old server (if any)
15 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
16 rm -f zebrasrv.pid
17 rm -f srv.log
18
19 echo "Starting server with -S (static)..."
20 ../../index/zebrasrv -S -c zebra1.cfg -l srv.log tcp:@:9901 &
21 sleep 1
22
23 echo "  checking that it runs... "
24 test -f zebrasrv.pid || exit 1
25 PID=`cat zebrasrv.pid`
26 ps -p $PID >/dev/null || exit 1
27
28 echo "  connecting to it..."
29 ../testclient localhost:9901 utah > log || exit 1
30 sleep 1
31
32 echo "  checking that it still runs..."
33 ps -p $PID >/dev/null || exit 1
34
35 echo "  connecting again, with a delay..."
36 ../testclient -d 5 localhost:9901 utah > log &
37 sleep 1 # let the client connect 
38
39 echo "  killing it..."
40 kill  $PID
41
42 echo "  checking that it is dead..."
43 ps -p $PID >/dev/null && exit 1
44
45 echo ok
46 # clean up
47 rm -rf reg idx.log srv.log zebrasrv.pid