Revert
[yaz-moved-to-github.git] / test / tstmarcxml.sh
1 #!/bin/sh
2 # $Id: tstmarcxml.sh,v 1.2 2006-04-20 19:47:02 adam Exp $
3 # Tests reading of MARCXML and checks that we get identical ISO2709 output.
4 srcdir=${srcdir:-.}
5 ecode=0
6 # Skip this test if Libxml2 support is not enabled
7 ../util/yaz-marcdump -x >/dev/null 2>&1
8 if test $? = "3"; then
9     exit 0
10 fi
11 for f in ${srcdir}/marc?.xml; do
12     NEW=`basename ${f}`.new.marc
13     OLD=${f}.marc
14     DIFF=`basename ${f}`.diff
15     ../util/yaz-marcdump -f utf-8 -t utf-8 -x -I $f > $NEW
16     if test $? != "0"; then
17         echo "Failed decode of $f"
18         ecode=1
19     elif test -f $OLD; then
20         if diff $OLD $NEW >$DIFF; then
21             rm $DIFF
22             rm $NEW
23         else
24             echo "$f: $NEW and $OLD Differ"
25             ecode=1
26         fi
27     else
28         echo "$f: Making test result $OLD for the first time"
29         mv $NEW $OLD
30     fi
31 done
32 exit $ecode
33