DH_COMPAT=4. Fix path in dh_installman invocation
[idzebra-moved-to-github.git] / test / xpath / test5.sh
1 #!/bin/sh
2 # $Id: test5.sh,v 1.3.2.1 2004-12-17 11:25:33 heikki Exp $
3
4 pp=${srcdir:-"."}
5
6 LOG="test5.log"
7 TMP="test5.tmp"
8 # DBG="-v 1647"
9 DBG=""
10
11 rm -f $LOG
12 rm -f $TMP.*
13 ../../index/zebraidx -c $pp/zebra.cfg -l $LOG init || exit 1
14 ../../index/zebraidx -c $pp/zebra.cfg -l $LOG -t grs.sgml update $pp/rec5.xml || exit 2
15 test -f dict*.mf || exit 1
16 ../../index/zebrasrv -c $pp/zebra.cfg -l $LOG $DBG -S unix:socket & 
17 sleep 1
18 test -f zebrasrv.pid || exit 2
19 ../api/testclient unix:socket '@attr 1=/record/title foo' >$TMP.1
20 ../api/testclient unix:socket '@attr 1=/record/title bar' >$TMP.2
21 ../api/testclient unix:socket "@attr {1=/record/title[@lang='da']} foo" >$TMP.3
22 ../api/testclient unix:socket "@attr {1=/record/title[@lang='en']} foo" >$TMP.4
23 ../api/testclient unix:socket "@attr 1=/record/title @and foo bar" >$TMP.5
24 # The last one returns two hits, as the and applies to the whole
25 # record, so it matches <title>foo</title><title>bar</title>
26 # This might not have to be like that, but currently that is what
27 # zebra does.
28 ../api/testclient unix:socket "@attr 1=/record/value bar" >$TMP.6
29 ../api/testclient unix:socket "@and @attr 1=/record/title foo @attr 1=/record/title grunt" >$TMP.7
30
31 ../api/testclient unix:socket "@attr {1=/record/title[@lang='en']} English" >$TMP.8
32 ../api/testclient unix:socket "@attr {1=/record/title[@lang='en']} Danish" >$TMP.9
33 ../api/testclient unix:socket "@attr {1=/record/title[@lang='da']} English" >$TMP.10
34 ../api/testclient unix:socket "@attr {1=/record/title[@lang='da']} Danish" >$TMP.11
35
36 echo 'Killing server' >>$LOG
37 kill `cat zebrasrv.pid` || exit 3
38 sleep 1
39 echo "Result counts: " >> $LOG
40 cat $TMP.* >>$LOG
41 echo 'Checking that result count is 4' >>$LOG
42 grep "^Result count: 4$" $TMP.1 >/dev/null || exit 4
43 echo 'Checking that result count is 2' >>$LOG
44 grep "^Result count: 2$" $TMP.2 >/dev/null || exit 5
45 echo 'Checking that result count is 1' >>$LOG
46 grep "^Result count: 1$" $TMP.3 >/dev/null || exit 6
47 echo 'Checking that result count is 1' >>$LOG
48 grep "^Result count: 1$" $TMP.4 >/dev/null || exit 7
49 echo 'Checking that result count is 2' >>$LOG
50 grep "^Result count: 2$" $TMP.5 >/dev/null || exit 8
51 echo 'Checking that result count is 1' >>$LOG
52 grep "^Result count: 1$" $TMP.6 >/dev/null || exit 9
53 echo 'Checking that result count is 1' >>$LOG
54 grep "^Result count: 1$" $TMP.7 >/dev/null || exit 10
55 echo 'Checking that result count is 1' >>$LOG
56 grep "^Result count: 1$" $TMP.8 >/dev/null || exit 11
57 echo 'Checking that result count is 0' >>$LOG
58 grep "^Result count: 0$" $TMP.9 >/dev/null || exit 12
59 echo 'Checking that result count is 0' >>$LOG
60 grep "^Result count: 0$" $TMP.10 >/dev/null || exit 13
61 echo 'Checking that result count is 1' >>$LOG
62 grep "^Result count: 1$" $TMP.11 >/dev/null || exit 14
63 echo 'Test OK' >>$LOG
64 exit 0
65