2 # $Id: test2.sh,v 1.13 2005-01-03 12:08:04 adam Exp $
10 rm -f $pp/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 $pp/records || exit 1
16 echo "update 2..." >>$LOG
17 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
19 echo "killing old server (if any)..." >>$LOG
20 test -f z.pid && kill -9 `cat z.pid`
22 echo "starting server..." >>$LOG
23 ../../index/zebrasrv -D -p z.pid -S -c $pp/zebra2.cfg -l $LOG unix:socket
24 test -f z.pid || exit 1
26 echo "search 1..." >>$LOG
27 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
28 grep "^Result count: 9$" log >/dev/null || exit 1
30 echo "update 3..." >>$LOG
31 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
33 echo "search 2..." >>$LOG
34 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
35 grep "^Result count: 9$" log >/dev/null || exit 1
37 echo "making test records..." >>$LOG
38 cp $pp/records/esdd0006.grs $pp/records/esdd0001.grs
40 echo "indexing them..." >>$LOG
41 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
43 echo "search 3..." >>$LOG
44 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
45 grep "^Result count: 10$" log >/dev/null || exit 1
46 touch $pp/records/esdd0001.grs
48 echo "indexing again..." >>$LOG
49 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
51 echo "search 4..." >>$LOG
52 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
53 grep "^Result count: 10$" log >/dev/null || exit 1
55 echo "making another test record..." >>$LOG
56 mv $pp/records/esdd0001.grs $pp/records/esdd0002.grs
58 echo "indexing it too..." >>$LOG
59 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
61 echo "search 5..." >>$LOG
62 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
63 grep "^Result count: 10$" log >/dev/null || exit 1
66 echo "modifying a test record..." >>$LOG
67 sed 's/UTAH/XYZ/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
68 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
70 echo "indexing it..." >>$LOG
71 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
74 echo "search 6..." >>$LOG
75 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
76 grep "^Result count: 9$" log >/dev/null || exit 1
78 echo "search 7..." >>$LOG
79 ../api/testclient unix:socket "@attr 1=4 xyz" > log || exit 1
80 grep "^Result count: 1$" log >/dev/null || exit 1
82 echo "stopping server..." >>$LOG
83 test -f z.pid || exit 1
84 kill `cat z.pid` || exit 1
86 rm -f $pp/records/esdd000[12].grs