Ignore zoomst10
[yaz-moved-to-github.git] / test / tstmarciso.sh
1 #!/bin/sh
2 # $Id: tstmarciso.sh,v 1.2 2006-04-20 19:47:02 adam Exp $
3 # Tests reading of ISO2709 and checks that we get identical MARCXML
4 srcdir=${srcdir:-.}
5 ecode=0
6 for f in ${srcdir}/marc?; do
7     NEW=`basename ${f}`.new.xml
8     OLD=${f}.xml
9     DIFF=`basename ${f}`.diff
10     ../util/yaz-marcdump -f `cat ${f}.chr` -t utf-8 -X $f > $NEW
11     if test $? != "0"; then
12         echo "$f: yaz-marcdump returned error"
13         ecode=1
14     elif test -f $OLD; then
15         if diff $OLD $NEW >$DIFF; then
16             rm $DIFF
17             rm $NEW
18         else
19             echo "$f: $NEW and $OLD differ"
20             ecode=1
21         fi
22     else
23         echo "$f: Making test result $OLD for the first time"
24         if test -x /usr/bin/xmllint; then
25             if xmllint --noout $NEW >out 2>stderr; then
26                 echo "$f: $NEW is well-formed"
27                 mv $NEW $OLD
28             else
29                 echo "$f: $NEW not well-formed"
30                 ecode=1
31             fi
32         else
33             echo "xmllint not found. install libxml2-utils"
34             ecode=1
35         fi
36     fi
37 done
38 exit $ecode
39