bypassing checks when running make distcheck
[idzebra-moved-to-github.git] / test / gils / test2.sh
1 #!/bin/sh
2 # $Id: test2.sh,v 1.14 2006-04-27 10:52:26 marc Exp $
3
4 srcdir=${srcdir:-"."}
5
6 if [ "$srcdir" != "." ]
7     then
8     echo "Jumping over test"
9     exit 0
10 fi
11
12 LOG=test2.log
13
14 rm -f $LOG
15 echo "init..." >>$LOG
16
17 # these should not be here, will be created later
18 $srcdir/cleanrecords.sh
19
20 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg init || exit 1
21
22 echo "update 1..." >>$LOG
23 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
24
25 echo "update 2..." >>$LOG
26 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
27
28 echo "killing old server (if any)..." >>$LOG
29 test -f z.pid && kill -9 `cat z.pid`
30
31 echo "starting server..." >>$LOG
32 ../../index/zebrasrv -D -p z.pid -S -c $srcdir/zebra2.cfg -l $LOG unix:socket
33 test -f z.pid || exit 1
34
35 echo "search 1..." >>$LOG
36 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
37 grep "^Result count: 9$" log >/dev/null || exit 1
38
39 echo "update 3..." >>$LOG
40 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
41
42 echo "search 2..." >>$LOG
43 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
44 grep "^Result count: 9$" log >/dev/null || exit 1
45
46 echo "making test records..." >>$LOG
47 cp $srcdir/records/esdd0006.grs $srcdir/records/esdd0001.grs
48
49 echo "indexing them..." >>$LOG
50 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
51
52 echo "search 3..." >>$LOG
53 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
54 grep "^Result count: 10$" log >/dev/null || exit 1
55 touch $srcdir/records/esdd0001.grs
56
57 echo "indexing again..." >>$LOG
58 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
59
60 echo "search 4..." >>$LOG
61 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
62 grep "^Result count: 10$" log >/dev/null || exit 1
63
64 echo "making another test record..." >>$LOG
65 mv $srcdir/records/esdd0001.grs $srcdir/records/esdd0002.grs
66
67 echo "indexing it too..." >>$LOG
68 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
69
70 echo "search 5..." >>$LOG
71 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
72 grep "^Result count: 10$" log >/dev/null || exit 1
73
74 sleep 1
75 echo "modifying a test record..." >>$LOG
76 sed 's/UTAH/XYZ/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
77 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
78
79 echo "indexing it..." >>$LOG
80 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
81 sleep 1
82
83 echo "search 6..." >>$LOG
84 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
85 grep "^Result count: 9$" log >/dev/null || exit 1
86
87 echo "search 7..." >>$LOG
88 ../api/testclient unix:socket "@attr 1=4 xyz" > log || exit 1
89 grep "^Result count: 1$" log >/dev/null || exit 1
90
91 echo "stosrcdiring server..." >>$LOG
92 test -f z.pid || exit 1
93 kill `cat z.pid` || exit 1
94 rm -f log
95 $srcdir/cleanrecords.sh
96 rm -f z.pid