2 # $Id: test2.sh,v 1.14 2006-04-27 10:52:26 marc Exp $
6 if [ "$srcdir" != "." ]
8 echo "Jumping over test"
17 # these should not be here, will be created later
18 $srcdir/cleanrecords.sh
20 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg init || exit 1
22 echo "update 1..." >>$LOG
23 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
25 echo "update 2..." >>$LOG
26 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
28 echo "killing old server (if any)..." >>$LOG
29 test -f z.pid && kill -9 `cat z.pid`
31 echo "starting server..." >>$LOG
32 ../../index/zebrasrv -D -p z.pid -S -c $srcdir/zebra2.cfg -l $LOG unix:socket
33 test -f z.pid || exit 1
35 echo "search 1..." >>$LOG
36 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
37 grep "^Result count: 9$" log >/dev/null || exit 1
39 echo "update 3..." >>$LOG
40 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
42 echo "search 2..." >>$LOG
43 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
44 grep "^Result count: 9$" log >/dev/null || exit 1
46 echo "making test records..." >>$LOG
47 cp $srcdir/records/esdd0006.grs $srcdir/records/esdd0001.grs
49 echo "indexing them..." >>$LOG
50 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
52 echo "search 3..." >>$LOG
53 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
54 grep "^Result count: 10$" log >/dev/null || exit 1
55 touch $srcdir/records/esdd0001.grs
57 echo "indexing again..." >>$LOG
58 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
60 echo "search 4..." >>$LOG
61 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
62 grep "^Result count: 10$" log >/dev/null || exit 1
64 echo "making another test record..." >>$LOG
65 mv $srcdir/records/esdd0001.grs $srcdir/records/esdd0002.grs
67 echo "indexing it too..." >>$LOG
68 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
70 echo "search 5..." >>$LOG
71 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
72 grep "^Result count: 10$" log >/dev/null || exit 1
75 echo "modifying a test record..." >>$LOG
76 sed 's/UTAH/XYZ/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
77 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
79 echo "indexing it..." >>$LOG
80 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
83 echo "search 6..." >>$LOG
84 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
85 grep "^Result count: 9$" log >/dev/null || exit 1
87 echo "search 7..." >>$LOG
88 ../api/testclient unix:socket "@attr 1=4 xyz" > log || exit 1
89 grep "^Result count: 1$" log >/dev/null || exit 1
91 echo "stosrcdiring server..." >>$LOG
92 test -f z.pid || exit 1
93 kill `cat z.pid` || exit 1
95 $srcdir/cleanrecords.sh