Renamed test0?.sh to stop0?.sh, added timing2
[idzebra-moved-to-github.git] / test / gils / timing2.sh
1 # timing2.sh 
2 # 2: Test without sleeps, fails around step 1a or 1b.
3
4 echo "Testing timings of updates"
5 echo "  init..."
6 rm -f idx.log log
7 rm -f records/esdd000[12].grs # these should not be here, will be created later
8 ../../index/zebraidx -l idx.log init || exit 1
9
10 echo "  killing old server (if any)..."
11 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
12 rm -f zebrasrv.pid
13 rm -f srv.log
14
15 echo "  starting server..."
16 ../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
17 sleep 1
18 test -f zebrasrv.pid || exit 1
19
20 echo "  update 1..."
21 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
22
23 echo "  search 1..."
24 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
25 grep "^Result count: 9$" log || exit 1
26
27 echo "making a test record..."
28 cp records/esdd0006.grs records/esdd0002.grs
29
30 echo "  indexing it..."
31 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
32
33 echo "  search 2..."
34 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
35 grep "^Result count: 10$" log || exit 1
36 echo "  1a: modifying a test record (xyz)..."
37 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
38 mv records/esdd0002x.grs records/esdd0002.grs
39
40 echo "    indexing it..."
41 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
42
43 echo "    search 3..."
44 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
45 echo "    checking..."
46 grep "^Result count: 9$" log || exit 1
47
48 echo "  1b: modifying the test record back (utah)..."
49 sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
50 mv records/esdd0002x.grs records/esdd0002.grs
51
52 echo "    indexing it..."
53 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
54
55 echo "    search 4..."
56 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
57 echo "    checking..."
58 grep "^Result count: 10$" log || exit 1
59
60 echo "  2a: modifying the test record (xyz)..."
61 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
62 mv records/esdd0002x.grs records/esdd0002.grs
63
64 echo "    indexing it..."
65 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
66
67 echo "    search 5..."
68 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
69 echo "    checking..."
70 grep "^Result count: 9$" log || exit 1
71
72 echo "  2b: modifying the test record back (utah)..."
73 sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
74 mv records/esdd0002x.grs records/esdd0002.grs
75
76 echo "    indexing it..."
77 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
78
79 echo "    search 6..."
80 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
81 echo "    checking..."
82 grep "^Result count: 10$" log || exit 1
83
84
85 echo "  3a: modifying the test record (xyz)..."
86 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
87 mv records/esdd0002x.grs records/esdd0002.grs
88
89 echo "    indexing it..."
90 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
91
92 echo "    search 7..."
93 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
94 echo "    checking..."
95 grep "^Result count: 9$" log || exit 1
96
97 echo "  3b: modifying the test record back (utah)..."
98 sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
99 mv records/esdd0002x.grs records/esdd0002.grs
100
101 echo "    indexing it..."
102 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
103
104 echo "    search 8..."
105 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
106 echo "    checking..."
107 grep "^Result count: 10$" log || exit 1
108
109
110 echo "stopping server..."
111 test -f zebrasrv.pid || exit 1
112 kill -9 `cat zebrasrv.pid` || exit 1
113 rm -f idx.log log
114 rm -f records/esdd000[12].grs 
115 rm -f zebrasrv.pid
116 rm -f srv.log
117
118 echo ok