1 # timing1.sh - tests that updates are reflected immediately
2 # in the registers. Repeatedly modifies a record and counts hits.
3 # Because of the timing aspect of this, if may fail at any time
6 echo "Testing timings of updates"
9 rm -f records/esdd000[12].grs # these should not be here, will be created later
10 ../../index/zebraidx -l idx.log init || exit 1
12 echo " killing old server (if any)..."
13 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
17 echo " starting server..."
18 ../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
20 test -f zebrasrv.pid || exit 1
23 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
26 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
27 grep "^Result count: 9$" log || exit 1
29 echo "making a test record..."
30 cp records/esdd0006.grs records/esdd0002.grs
32 echo " indexing it..."
33 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
36 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
37 grep "^Result count: 10$" log || exit 1
38 echo " 1a: modifying a test record (xyz)..."
39 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
40 mv records/esdd0002x.grs records/esdd0002.grs
42 echo " indexing it..."
43 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
46 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
48 grep "^Result count: 9$" log || exit 1
50 echo " 1b: modifying the test record back (utah)..."
51 sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
52 mv records/esdd0002x.grs records/esdd0002.grs
54 echo " indexing it..."
55 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
58 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
60 grep "^Result count: 10$" log || exit 1
62 echo " 2a: modifying the test record (xyz)..."
63 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
64 mv records/esdd0002x.grs records/esdd0002.grs
66 echo " indexing it..."
67 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
70 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
72 grep "^Result count: 9$" log || exit 1
74 echo " 2b: modifying the test record back (utah)..."
75 sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
76 mv records/esdd0002x.grs records/esdd0002.grs
78 echo " indexing it..."
79 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
82 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
84 grep "^Result count: 10$" log || exit 1
87 echo " 3a: modifying the test record (xyz)..."
88 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
89 mv records/esdd0002x.grs records/esdd0002.grs
91 echo " indexing it..."
92 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
95 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
97 grep "^Result count: 9$" log || exit 1
99 echo " 3b: modifying the test record back (utah)..."
100 sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
101 mv records/esdd0002x.grs records/esdd0002.grs
103 echo " indexing it..."
104 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
107 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
109 grep "^Result count: 10$" log || exit 1
112 echo "stopping server..."
113 test -f zebrasrv.pid || exit 1
114 kill -9 `cat zebrasrv.pid` || exit 1
116 rm -f records/esdd000[12].grs