Fixed bug #643: Bad sequence for MARC conversions from UTF-8 to MARC-8.
[yaz-moved-to-github.git] / test / tstmarciso.sh
index 9bf324d..0ff5022 100755 (executable)
@@ -1,32 +1,36 @@
 #!/bin/sh
-# $Id: tstmarciso.sh,v 1.1 2006-04-19 10:05:04 adam Exp $
+# $Id: tstmarciso.sh,v 1.3 2006-08-28 12:34:42 adam Exp $
 # Tests reading of ISO2709 and checks that we get identical MARCXML
+# 
+# Reads marc?.marc files , Generates marc?.xml files
 srcdir=${srcdir:-.}
 ecode=0
-for f in ${srcdir}/marc?; do
-    NEW=`basename ${f}`.new.xml
-    OLD=${f}.xml
+for f in ${srcdir}/marc?.marc; do
+    fb=`basename ${f} .marc`
+    CHR=${srcdir}/${fb}.chr
+    NEW=${fb}.new.xml
+    OLD=${srcdir}/${fb}.xml
     DIFF=`basename ${f}`.diff
-    ../util/yaz-marcdump -f `cat ${f}.chr` -t utf-8 -X $f > $NEW
+    ../util/yaz-marcdump -f `cat $CHR` -t utf-8 -X $f > $NEW
     if test $? != "0"; then
-       echo "Failed decode of $f"
+       echo "$f: yaz-marcdump returned error"
        ecode=1
     elif test -f $OLD; then
         if diff $OLD $NEW >$DIFF; then
            rm $DIFF
            rm $NEW
        else
-           echo "Differ in $f"
+           echo "$f: $NEW and $OLD differ"
            ecode=1
        fi
     else
-       echo "Making test $f for the first time"
+       echo "$f: Making test result $OLD for the first time"
        if test -x /usr/bin/xmllint; then
            if xmllint --noout $NEW >out 2>stderr; then
-               echo "XML for $f is OK"
+               echo "$f: $NEW is well-formed"
                mv $NEW $OLD
            else
-               echo "XML for $f is invalid"
+               echo "$f: $NEW not well-formed"
                ecode=1
            fi
        else
@@ -37,3 +41,8 @@ for f in ${srcdir}/marc?; do
 done
 exit $ecode
 
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 4
+# End: