Makefile updates for Automake 1.5+. Test script updates
[idzebra-moved-to-github.git] / test / gils / stop03.sh
1 #!/bin/sh
2 # $Id: stop03.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
3 # test start and stop of the threaded server (-T)
4 #
5 # FIXME - this test does not currently pass  (H 22-oct-2002)
6 # When the client exits, the process dies with a segfault
7
8 echo "initializing"
9 mkdir -p reg
10 rm -f idx.log srv.log servercrash
11 ../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
12
13 #create a base to test on
14 ../../index/zebraidx -l idx.log -c zebra1.cfg update records  || exit 1
15
16 #kill old server (if any)
17 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
18 rm -f zebrasrv.pid
19 rm -f srv.log
20
21 echo "Starting server with -T (threaded)..."
22 (
23   ../../index/zebrasrv -T -c zebra1.cfg -l srv.log tcp:@:9901 ||
24     echo "server failed with $?" > servercrash
25 )&
26 sleep 1
27
28 echo "  checking that it runs... "
29 test -f zebrasrv.pid || exit 1
30 PID=`cat zebrasrv.pid`
31 ps -p $PID | grep $PID >/dev/null || exit 1
32
33 echo "  connecting to it..."
34 ../api/testclient localhost:9901 utah > log || exit 1
35 sleep 1
36
37 echo "  checking that it still runs..."
38 ps -p $PID >/dev/null || exit 1
39
40 echo "  connecting again, with a delay..."
41 ../api/testclient localhost:9901 utah 5 > log &
42 sleep 1 # let the client connect 
43
44 echo "  killing it..."
45 kill  $PID
46 sleep 1
47
48 echo "  checking that it is dead"
49 ps -p $PID | grep $PID >/dev/null && exit 1
50
51 # clean up
52 rm -rf reg idx.log srv.log zebrasrv.pid servercrash