Moved the test sequences (old t[1-8].sh) into more consistent scripts
[idzebra-moved-to-github.git] / test / gils / test1.sh
1 echo "testing without stored keys (zebra1.cfg)"
2
3 echo  "initializing..."
4 mkdir -p reg
5 rm -f records/esdd000[12].grs # these should not be here, will be created later
6 rm -f idx.log srv.log
7 ../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
8
9 echo "updating..."
10 ../../index/zebraidx -l idx.log -c zebra1.cfg update records  || exit 1
11
12 echo "killing old server (if any)..."
13 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
14 rm -f zebrasrv.pid
15 rm -f srv.log
16
17 echo "starting server..."
18 ../../index/zebrasrv -S -c zebra1.cfg -l srv.log tcp:@:9901 &
19 sleep 1
20
21 echo "cheking it runs..."
22 test -f zebrasrv.pid || exit 1
23
24 echo "search 1..."
25 ../testclient localhost:9901 utah > log || exit 1
26 grep "^Result count: 17$" log || exit 1
27
28 echo "search 2..."
29 ../testclient localhost:9901 "@or utah the" > log || exit 1
30 grep "^Result count: 40$" log || exit 1
31
32 echo "search 3..."
33 ../testclient localhost:9901 "@attr 1=4 the" > log || exit 1
34 grep "^Result count: 1$" log || exit 1
35
36 echo "search 4..."
37 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
38 grep "^Result count: 9$" log || exit 1
39
40 echo "reindexing..."
41 ../../index/zebraidx -l idx.log -c  zebra1.cfg update records || exit 1
42
43 echo "search 5..."
44 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
45 grep "^Result count: 18$" log || exit 1
46
47 echo "stopping server..."
48 test -f zebrasrv.pid || exit 1
49 kill -9 `cat zebrasrv.pid` || exit 1
50 rm -f zebrasrv.pid
51
52 echo "ok"