2 # $Id: test2.sh,v 1.8 2004-06-15 08:06:34 adam Exp $
10 rm -f records/esdd000[12].grs # these should not be here, will be created later
11 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg init || exit 1
13 echo "update 1..." >>$LOG
14 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update records || exit 1
16 echo "update 2..." >>$LOG
17 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update records || exit 1
19 echo "killing old server (if any)..." >>$LOG
20 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
22 echo "starting server..." >>$LOG
23 ../../index/zebrasrv -S -c $pp/zebra2.cfg -l $LOG tcp:@:9901 &
25 test -f zebrasrv.pid || exit 1
27 echo "search 1..." >>$LOG
28 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
29 grep "^Result count: 9$" log >/dev/null || exit 1
31 echo "update 3..." >>$LOG
32 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update records || exit 1
34 echo "search 2..." >>$LOG
35 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
36 grep "^Result count: 9$" log >/dev/null || exit 1
38 echo "making test records..." >>$LOG
39 cp records/esdd0006.grs records/esdd0001.grs
41 echo "indexing them..." >>$LOG
42 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update records || exit 1
44 echo "search 3..." >>$LOG
45 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
46 grep "^Result count: 10$" log >/dev/null || exit 1
47 touch records/esdd0001.grs
49 echo "indexing again..." >>$LOG
50 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update records || exit 1
52 echo "search 4..." >>$LOG
53 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
54 grep "^Result count: 10$" log >/dev/null || exit 1
56 echo "making another test record..." >>$LOG
57 mv records/esdd0001.grs records/esdd0002.grs
59 echo "indexing it too..." >>$LOG
60 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update records || exit 1
62 echo "search 5..." >>$LOG
63 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
64 grep "^Result count: 10$" log >/dev/null || exit 1
67 echo "modifying a test record..." >>$LOG
68 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
69 mv records/esdd0002x.grs records/esdd0002.grs
71 echo "indexing it..." >>$LOG
72 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update records || exit 1
75 echo "search 6..." >>$LOG
76 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
77 grep "^Result count: 9$" log >/dev/null || exit 1
79 echo "search 7..." >>$LOG
80 ../api/testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
81 grep "^Result count: 1$" log >/dev/null || exit 1
83 echo "stopping server..." >>$LOG
84 test -f zebrasrv.pid || exit 1
85 kill `cat zebrasrv.pid` || exit 1
87 rm -f records/esdd000[12].grs