2 # $Id: test2.sh,v 1.7 2003-05-24 22:34:48 adam Exp $
8 rm -f records/esdd000[12].grs # these should not be here, will be created later
9 ../../index/zebraidx -l $LOG -c zebra2.cfg init || exit 1
11 echo "update 1..." >>$LOG
12 ../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
14 echo "update 2..." >>$LOG
15 ../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
17 echo "killing old server (if any)..." >>$LOG
18 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
20 echo "starting server..." >>$LOG
21 ../../index/zebrasrv -S -c zebra2.cfg -l $LOG tcp:@:9901 &
23 test -f zebrasrv.pid || exit 1
25 echo "search 1..." >>$LOG
26 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
27 grep "^Result count: 9$" log >/dev/null || exit 1
29 echo "update 3..." >>$LOG
30 ../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
32 echo "search 2..." >>$LOG
33 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
34 grep "^Result count: 9$" log >/dev/null || exit 1
36 echo "making test records..." >>$LOG
37 cp records/esdd0006.grs records/esdd0001.grs
39 echo "indexing them..." >>$LOG
40 ../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
42 echo "search 3..." >>$LOG
43 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
44 grep "^Result count: 10$" log >/dev/null || exit 1
45 touch records/esdd0001.grs
47 echo "indexing again..." >>$LOG
48 ../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
50 echo "search 4..." >>$LOG
51 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
52 grep "^Result count: 10$" log >/dev/null || exit 1
54 echo "making another test record..." >>$LOG
55 mv records/esdd0001.grs records/esdd0002.grs
57 echo "indexing it too..." >>$LOG
58 ../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
60 echo "search 5..." >>$LOG
61 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
62 grep "^Result count: 10$" log >/dev/null || exit 1
65 echo "modifying a test record..." >>$LOG
66 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
67 mv records/esdd0002x.grs records/esdd0002.grs
69 echo "indexing it..." >>$LOG
70 ../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
73 echo "search 6..." >>$LOG
74 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
75 grep "^Result count: 9$" log >/dev/null || exit 1
77 echo "search 7..." >>$LOG
78 ../api/testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
79 grep "^Result count: 1$" log >/dev/null || exit 1
81 echo "stopping server..." >>$LOG
82 test -f zebrasrv.pid || exit 1
83 kill `cat zebrasrv.pid` || exit 1
85 rm -f records/esdd000[12].grs