Removed zebra_search_rpn. Updated a few tests
[idzebra-moved-to-github.git] / test / gils / test2.sh
1 #!/bin/sh
2 # $Id: test2.sh,v 1.5 2003-05-06 20:09:28 adam Exp $
3 echo "Testing with storekeys (zebra2.cfg)"
4 echo "init..."
5 rm -f idx.log log
6 rm -f records/esdd000[12].grs # these should not be here, will be created later
7 ../../index/zebraidx -l idx.log -c zebra2.cfg init || exit 1
8
9 echo "update 1..."
10 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
11
12 echo "update 2..."
13 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
14
15 echo "killing old server (if any)..."
16 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
17 rm -f zebrasrv.pid
18 rm -f srv.log
19
20 echo "starting server..."
21 ../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
22 sleep 1
23 test -f zebrasrv.pid || exit 1
24
25 echo "search 1..."
26 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
27 grep "^Result count: 9$" log || exit 1
28
29 echo "update 3..."
30 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
31
32 echo "search 2..."
33 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
34 grep "^Result count: 9$" log || exit 1
35
36 echo "making test records..."
37 cp records/esdd0006.grs records/esdd0001.grs
38
39 echo "indexing them..."
40 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
41
42 echo "search 3..."
43 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
44 grep "^Result count: 10$" log || exit 1
45 touch records/esdd0001.grs
46
47 echo "indexing again..."
48 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
49
50 echo "search 4..."
51 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
52 grep "^Result count: 10$" log || exit 1
53
54 echo "making another test record..."
55 mv records/esdd0001.grs records/esdd0002.grs
56
57 echo "indexing it too..."
58 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
59
60 echo "search 5..."
61 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
62 grep "^Result count: 10$" log || exit 1
63
64 sleep 1
65 echo "modifying a test record..."
66 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
67 mv records/esdd0002x.grs records/esdd0002.grs
68
69 echo "indexing it..."
70 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
71 sleep 1
72
73 echo "search 6..."
74 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
75 grep "^Result count: 9$" log || exit 1
76
77 echo "search 7..."
78 ../testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
79 grep "^Result count: 1$" log || exit 1
80
81 echo "stopping server..."
82 test -f zebrasrv.pid || exit 1
83 kill `cat zebrasrv.pid` || exit 1
84 rm -f idx.log log
85 rm -f records/esdd000[12].grs 
86 rm -f zebrasrv.pid
87 rm -f srv.log