Added new regression test using yaz-icu
[yaz-moved-to-github.git] / test / tsticu.sh
1 #!/bin/sh
2 # Tests a couple of yaz-icu conversions
3
4 # Reads tsticu-[0-9].input files
5 # Writes tsticu-[0-9].output / output.tmp files
6 # Config tsticu-[0-9].xml
7
8 set -x
9 srcdir=${srcdir:-.}
10 ecode=0
11
12 ../util/yaz-icu >/dev/null 2>&1
13 if test $? = "3"; then
14     exit 0
15 fi
16
17 for f in ${srcdir}/tsticu-[0-9].input; do
18     fb=`basename ${f} .input`
19     CONFIG=${srcdir}/${fb}.xml
20     NEW=${fb}.output.tmp
21     OLD=${srcdir}/${fb}.output
22     DIFF=`basename ${f}`.diff
23     ../util/yaz-icu -c $CONFIG <$f > $NEW
24     if test $? != "0"; then
25         echo "$f: yaz-icu returned error"
26         ecode=1
27     elif test -f $OLD; then
28         if diff $OLD $NEW >$DIFF; then
29             rm $DIFF
30             rm $NEW
31         else
32             echo "$f: $NEW and $OLD differ"
33             ecode=1
34         fi
35     else
36         echo "$f: Making test result $OLD for the first time"
37         mv $NEW $OLD
38         ecode=1
39     fi
40 done
41 exit $ecode
42
43 # Local Variables:
44 # mode:shell-script
45 # sh-indentation: 2
46 # sh-basic-offset: 4
47 # End: