2 # $Id: timing1.sh,v 1.13 2006-04-27 10:52:27 marc Exp $
3 # tests that updates are reflected immediately # in the registers.
4 # Repeatedly modifies a record and counts hits.
5 # Test 1: with good sleeps in every between - should pass always
9 if [ "$srcdir" != "." ]
11 echo "Jumping over test"
19 echo " init..." >>$LOG
21 # these should not be here, will be created later
22 $srcdir/cleanrecords.sh
25 ../../index/zebraidx -c $srcdir/zebra2.cfg -l $LOG init || exit 1
27 echo " starting server..." >>$LOG
28 ../../index/zebrasrv -D -p z.pid -S -c $srcdir/zebra2.cfg -l $LOG unix:socket
29 test -f z.pid || exit 1
32 echo " update 1..." >>$LOG
33 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
36 echo " search 1..." >>$LOG
37 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
38 grep "^Result count: 9$" log >/dev/null || exit 1
41 echo "making a test record..." >>$LOG
42 cp $srcdir/records/esdd0006.grs $srcdir/records/esdd0002.grs
44 echo " indexing it..." >>$LOG
45 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
48 echo " search 2..." >>$LOG
49 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
50 grep "^Result count: 10$" log >/dev/null || exit 1
53 echo " 1a: modifying a test record (xyz)..." >>$LOG
54 sed 's/UTAH/XYZ/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
55 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
57 echo " indexing it..." >>$LOG
58 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
61 echo " search 3..." >>$LOG
62 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
63 echo " checking..." >>$LOG
64 grep "^Result count: 9$" log >/dev/null || exit 1
67 echo " 1b: modifying the test record back (utah)..." >>$LOG
68 sed 's/XYZ/UTAH/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
69 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
71 echo " indexing it..." >>$LOG
72 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
75 echo " search 4..." >>$LOG
76 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
77 echo " checking..." >>$LOG
78 grep "^Result count: 10$" log >/dev/null || exit 1
81 echo " 2a: modifying the test record (xyz)..." >>$LOG
82 sed 's/UTAH/XYZ/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
83 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
85 echo " indexing it..." >>$LOG
86 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
89 echo " search 5..." >>$LOG
90 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
91 echo " checking..." >>$LOG
92 grep "^Result count: 9$" log >/dev/null || exit 1
95 echo " 2b: modifying the test record back (utah)..." >>$LOG
96 sed 's/XYZ/UTAH/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
97 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
100 echo " indexing it..." >>$LOG
101 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
104 echo " search 6..." >>$LOG
105 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
106 echo " checking..." >>$LOG
107 grep "^Result count: 10$" log >/dev/null || exit 1
111 echo " 3a: modifying the test record (xyz)..." >>$LOG
112 sed 's/UTAH/XYZ/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
113 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
116 echo " indexing it..." >>$LOG
117 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
120 echo " search 7..." >>$LOG
121 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
122 echo " checking..." >>$LOG
123 grep "^Result count: 9$" log >/dev/null || exit 1
126 echo " 3b: modifying the test record back (utah)..." >>$LOG
127 sed 's/XYZ/UTAH/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
128 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
130 echo " indexing it..." >>$LOG
131 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
134 echo " search 8..." >>$LOG
135 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
136 echo " checking..." >>$LOG
137 grep "^Result count: 10$" log >/dev/null || exit 1
139 echo "stopping server..." >>$LOG
140 test -f z.pid || exit 1
141 kill `cat z.pid` || exit 1
143 $srcdir/cleanrecords.sh