ZOOM: use size_t for scan hit counts and str size
[yaz-moved-to-github.git] / test / tstcql2pqf.sh
1 #!/bin/sh
2 srcdir=${srcdir:-.}
3 oIFS="$IFS"
4 IFS='
5 '
6 secno=0
7 testno=0
8 comment=0
9 ecode=0
10 test -f ${srcdir}/cql2pqfsample || exit 1
11 test -d cql2pqf || mkdir cql2pqf
12 for f in `cat ${srcdir}/cql2pqfsample`; do
13         if echo $f | grep '^#' >/dev/null; then
14                 comment=1
15         else
16                 if test "$comment" = "1"; then
17                         secno=`expr $secno + 1`
18                         testno=0
19                 fi
20                 comment=0
21                 testno=`expr $testno + 1`
22                 OUT1=${srcdir}/cql2pqf/$secno.$testno.out
23                 ERR1=${srcdir}/cql2pqf/$secno.$testno.err
24                 OUT2=cql2pqf/$secno.$testno.out.tmp
25                 ERR2=cql2pqf/$secno.$testno.err.tmp
26                 DIFF=cql2pqf/$secno.$testno.diff
27                 ../util/cql2pqf ${srcdir}/../etc/pqf.properties "$f" >$OUT2 2>$ERR2
28                 if test -f $OUT1 -a -f $ERR1; then
29                         if diff $OUT1 $OUT2 >$DIFF; then
30                                 rm $DIFF
31                                 rm $OUT2
32                         else
33                                 echo "diff out $secno $testno $f"
34                                 cat $DIFF
35                                 ecode=1 
36                         fi
37                         if diff $ERR1 $ERR2 >$DIFF; then
38                                 rm $DIFF
39                                 rm $ERR2
40                         else
41                                 echo "diff err $secno $testno $f"
42                                 cat $DIFF
43                                 ecode=1
44                         fi
45                 else
46                         echo "making test $secno $testno $f"
47                         mv $OUT2 $OUT1
48                         mv $ERR2 $ERR1
49                         ecode=1
50                 fi      
51         fi              
52 done
53 IFS="$oIFS"
54 exit $ecode