Fixed bug #643: Bad sequence for MARC conversions from UTF-8 to MARC-8.
[yaz-moved-to-github.git] / test / tstmarcxml.sh
1 #!/bin/sh
2 # $Id: tstmarcxml.sh,v 1.3 2006-08-28 12:34:42 adam Exp $
3 # Tests reading of MARCXML and checks that we get identical ISO2709 output.
4 #
5 # Reads marc?.xml files , Generates marc?.xml.marc files
6 srcdir=${srcdir:-.}
7 ecode=0
8 # Skip this test if Libxml2 support is not enabled
9 ../util/yaz-marcdump -x >/dev/null 2>&1
10 if test $? = "3"; then
11     exit 0
12 fi
13 for f in ${srcdir}/marc?.xml; do
14     NEW=`basename ${f}`.new.marc
15     OLD=${f}.marc
16     DIFF=`basename ${f}`.diff
17     ../util/yaz-marcdump -f utf-8 -t utf-8 -x -I $f > $NEW
18     if test $? != "0"; then
19         echo "Failed decode of $f"
20         ecode=1
21     elif test -f $OLD; then
22         if diff $OLD $NEW >$DIFF; then
23             rm $DIFF
24             rm $NEW
25         else
26             echo "$f: $NEW and $OLD Differ"
27             ecode=1
28         fi
29     else
30         echo "$f: Making test result $OLD for the first time"
31         mv $NEW $OLD
32     fi
33 done
34 exit $ecode
35
36 # Local Variables:
37 # mode:shell-script
38 # sh-indentation: 2
39 # sh-basic-offset: 4
40 # End: