Omit CVS Id. Update copyright year.
[idzebra-moved-to-github.git] / test / gils / test1.sh
1 #!/bin/sh
2
3 srcdir=${srcdir:-"."}
4
5 if [ "$srcdir" != "." ]
6     then
7     echo "Jumping over test"
8     exit 0
9 fi
10
11
12 LOG=test1.log
13
14 rm -f $LOG
15 echo  "initializing..." >>$LOG
16 test -d reg || mkdir reg
17
18 # these should not be here, will be created later
19 $srcdir/cleanrecords.sh
20 #if [ -f $srcdir/records/esdd0001.grs ] 
21 #    then
22 #    rm -f $srcdir/records/esdd0001.grs
23 #fi
24 #if [ -f $srcdir/records/esdd0002.grs ] 
25 #    then
26 #    rm -f $srcdir/records/esdd0002.grs
27 #fi
28
29 ../../index/zebraidx -l $LOG -c $srcdir/zebra1.cfg init || exit 1
30
31 echo "updating..." >>$LOG
32 ../../index/zebraidx -l $LOG -c $srcdir/zebra1.cfg update $srcdir/records  || exit 1
33
34 echo "starting server..." >>$LOG
35 ../../index/zebrasrv -D -p z.pid -S -c $srcdir/zebra1.cfg -l $LOG unix:socket
36
37 echo "checking it runs..." >>$LOG
38 test -f z.pid || exit 1
39
40 echo "search 1..." >>$LOG
41 ../api/testclient unix:socket utah > log || exit 1
42 grep "^Result count: 17$" log >/dev/null || exit 1
43
44 echo "search 2..." >>$LOG
45 ../api/testclient unix:socket "@or utah the" > log || exit 1
46 grep "^Result count: 41$" log >/dev/null || exit 1
47
48 echo "search 3..." >>$LOG
49 ../api/testclient unix:socket "@attr 1=4 the" > log || exit 1
50 grep "^Result count: 1$" log >/dev/null || exit 1
51
52 echo "search 4..." >>$LOG
53 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
54 grep "^Result count: 9$" log >/dev/null || exit 1
55
56 echo "reindexing..." >>$LOG
57 ../../index/zebraidx -l $LOG -c $srcdir/zebra1.cfg update $srcdir/records || exit 1
58
59 echo "search 5..." >>$LOG
60 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
61 grep "^Result count: 18$" log >/dev/null || exit 1
62
63 echo "stopping server..." >>$LOG
64 test -f z.pid || exit 1
65 kill `cat z.pid` || exit 1
66 rm -f z.pid
67