2 # $Id: test1.sh,v 1.10 2004-09-24 15:03:19 adam Exp $
9 echo "initializing..." >>$LOG
10 test -d reg || mkdir reg
11 rm -f $pp/records/esdd000[12].grs # these should not be here, will be created later
12 ../../index/zebraidx -l $LOG -c $pp/zebra1.cfg init || exit 1
14 echo "updating..." >>$LOG
15 ../../index/zebraidx -l $LOG -c $pp/zebra1.cfg update $pp/records || exit 1
17 echo "killing old server (if any)..." >>$LOG
18 test -f zebrasrv.pid && kill `cat zebrasrv.pid`
20 echo "starting server..." >>$LOG
21 ../../index/zebrasrv -S -c $pp/zebra1.cfg -l $LOG tcp:@:9901 &
24 echo "checking it runs..." >>$LOG
25 test -f zebrasrv.pid || sleep 5 || test -f zebrasrv.pid || exit 1
27 echo "search 1..." >>$LOG
28 ../api/testclient localhost:9901 utah > log || exit 1
29 grep "^Result count: 17$" log >/dev/null || exit 1
31 echo "search 2..." >>$LOG
32 ../api/testclient localhost:9901 "@or utah the" > log || exit 1
33 grep "^Result count: 40$" log >/dev/null || exit 1
35 echo "search 3..." >>$LOG
36 ../api/testclient localhost:9901 "@attr 1=4 the" > log || exit 1
37 grep "^Result count: 1$" log >/dev/null || exit 1
39 echo "search 4..." >>$LOG
40 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
41 grep "^Result count: 9$" log >/dev/null || exit 1
43 echo "reindexing..." >>$LOG
44 ../../index/zebraidx -l $LOG -c $pp/zebra1.cfg update $pp/records || exit 1
46 echo "search 5..." >>$LOG
47 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
48 grep "^Result count: 18$" log >/dev/null || exit 1
50 echo "stopping server..." >>$LOG
51 test -f zebrasrv.pid || exit 1
52 kill `cat zebrasrv.pid` || exit 1