Fixed bug #830: pkg-config support. YAZ installs yaz.pc for Debian
[yaz-moved-to-github.git] / test / tstcql.sh
1 #!/bin/sh
2 # $Id: tstcql.sh,v 1.4 2004-11-16 22:44:31 adam Exp $
3 srcdir=${srcdir:-.}
4 oIFS="$IFS"
5 IFS='
6 '
7 secno=0
8 testno=0
9 comment=0
10 ecode=0
11 test -f ${srcdir}/cqlsample || exit 1
12 test -d cql || mkdir cql
13 for f in `cat ${srcdir}/cqlsample`; do
14         if echo $f | grep '^#' >/dev/null; then
15                 comment=1
16         else
17                 if test "$comment" = "1"; then
18                         secno=`expr $secno + 1`
19                         testno=0
20                 fi
21                 comment=0
22                 testno=`expr $testno + 1`
23                 OUT1=${srcdir}/cql/$secno.$testno.out
24                 ERR1=${srcdir}/cql/$secno.$testno.err
25                 OUT2=cql/$secno.$testno.out.tmp
26                 ERR2=cql/$secno.$testno.err.tmp
27                 DIFF=cql/$secno.$testno.diff
28                 ../util/cql2xcql "$f" >$OUT2 2>$ERR2
29                 if test -f $OUT1 -a -f $ERR1; then
30                         if diff $OUT1 $OUT2 >$DIFF; then
31                                 rm $DIFF
32                                 rm $OUT2
33                         else
34                                 echo "diff out $secno $testno $f"
35                                 cat $DIFF
36                                 ecode=1 
37                         fi
38                         if diff $ERR1 $ERR2 >$DIFF; then
39                                 rm $DIFF
40                                 rm $ERR2
41                         else
42                                 echo "diff err $secno $testno $f"
43                                 cat $DIFF
44                                 ecode=1
45                         fi
46                 else
47                         echo "making test $secno $testno $f"
48                         mv $OUT2 $OUT1
49                         mv $ERR2 $ERR1
50                         ecode=1
51                 fi      
52         fi              
53 done
54 IFS="$oIFS"
55 exit $ecode