2 # $Id: test1.sh,v 1.15 2006-05-19 13:49:36 adam Exp $
6 if [ "$srcdir" != "." ]
8 echo "Jumping over test"
16 echo "initializing..." >>$LOG
17 test -d reg || mkdir reg
19 # these should not be here, will be created later
20 $srcdir/cleanrecords.sh
21 #if [ -f $srcdir/records/esdd0001.grs ]
23 # rm -f $srcdir/records/esdd0001.grs
25 #if [ -f $srcdir/records/esdd0002.grs ]
27 # rm -f $srcdir/records/esdd0002.grs
30 ../../index/zebraidx -l $LOG -c $srcdir/zebra1.cfg init || exit 1
32 echo "updating..." >>$LOG
33 ../../index/zebraidx -l $LOG -c $srcdir/zebra1.cfg update $srcdir/records || exit 1
35 echo "starting server..." >>$LOG
36 ../../index/zebrasrv -D -p z.pid -S -c $srcdir/zebra1.cfg -l $LOG unix:socket
38 echo "checking it runs..." >>$LOG
39 test -f z.pid || exit 1
41 echo "search 1..." >>$LOG
42 ../api/testclient unix:socket utah > log || exit 1
43 grep "^Result count: 17$" log >/dev/null || exit 1
45 echo "search 2..." >>$LOG
46 ../api/testclient unix:socket "@or utah the" > log || exit 1
47 grep "^Result count: 41$" log >/dev/null || exit 1
49 echo "search 3..." >>$LOG
50 ../api/testclient unix:socket "@attr 1=4 the" > log || exit 1
51 grep "^Result count: 1$" log >/dev/null || exit 1
53 echo "search 4..." >>$LOG
54 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
55 grep "^Result count: 9$" log >/dev/null || exit 1
57 echo "reindexing..." >>$LOG
58 ../../index/zebraidx -l $LOG -c $srcdir/zebra1.cfg update $srcdir/records || exit 1
60 echo "search 5..." >>$LOG
61 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
62 grep "^Result count: 18$" log >/dev/null || exit 1
64 echo "stopping server..." >>$LOG
65 test -f z.pid || exit 1
66 kill `cat z.pid` || exit 1