2 # $Id: timing1.sh,v 1.12 2005-01-03 12:08:04 adam 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
13 echo " init..." >>$LOG
14 rm -f $pp/records/esdd000[12].grs # these should not be here, will be created later
15 ../../index/zebraidx -c $pp/zebra2.cfg -l $LOG init || exit 1
17 echo " starting server..." >>$LOG
18 ../../index/zebrasrv -D -p z.pid -S -c $pp/zebra2.cfg -l $LOG unix:socket
19 test -f z.pid || exit 1
22 echo " update 1..." >>$LOG
23 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || 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
31 echo "making a test record..." >>$LOG
32 cp $pp/records/esdd0006.grs $pp/records/esdd0002.grs
34 echo " indexing it..." >>$LOG
35 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
38 echo " search 2..." >>$LOG
39 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
40 grep "^Result count: 10$" log >/dev/null || exit 1
43 echo " 1a: modifying a test record (xyz)..." >>$LOG
44 sed 's/UTAH/XYZ/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
45 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
47 echo " indexing it..." >>$LOG
48 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
51 echo " search 3..." >>$LOG
52 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
53 echo " checking..." >>$LOG
54 grep "^Result count: 9$" log >/dev/null || exit 1
57 echo " 1b: modifying the test record back (utah)..." >>$LOG
58 sed 's/XYZ/UTAH/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
59 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
61 echo " indexing it..." >>$LOG
62 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
65 echo " search 4..." >>$LOG
66 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
67 echo " checking..." >>$LOG
68 grep "^Result count: 10$" log >/dev/null || exit 1
71 echo " 2a: modifying the test record (xyz)..." >>$LOG
72 sed 's/UTAH/XYZ/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
73 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
75 echo " indexing it..." >>$LOG
76 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
79 echo " search 5..." >>$LOG
80 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
81 echo " checking..." >>$LOG
82 grep "^Result count: 9$" log >/dev/null || exit 1
85 echo " 2b: modifying the test record back (utah)..." >>$LOG
86 sed 's/XYZ/UTAH/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
87 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
90 echo " indexing it..." >>$LOG
91 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
94 echo " search 6..." >>$LOG
95 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
96 echo " checking..." >>$LOG
97 grep "^Result count: 10$" log >/dev/null || exit 1
101 echo " 3a: modifying the test record (xyz)..." >>$LOG
102 sed 's/UTAH/XYZ/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
103 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
106 echo " indexing it..." >>$LOG
107 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
110 echo " search 7..." >>$LOG
111 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
112 echo " checking..." >>$LOG
113 grep "^Result count: 9$" log >/dev/null || exit 1
116 echo " 3b: modifying the test record back (utah)..." >>$LOG
117 sed 's/XYZ/UTAH/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
118 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
120 echo " indexing it..." >>$LOG
121 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
124 echo " search 8..." >>$LOG
125 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
126 echo " checking..." >>$LOG
127 grep "^Result count: 10$" log >/dev/null || exit 1
129 echo "stopping server..." >>$LOG
130 test -f z.pid || exit 1
131 kill `cat z.pid` || exit 1
133 rm -f $pp/records/esdd000[12].grs