2 # Tests reading of ISO2709 and checks that we get identical MARCXML
4 # Reads marc?.marc files , Generates marc*.xml files
5 # If Libxml2 is present, also turbomarc*xml.
6 # as well as reverse transformation from *marc*.xml files are parsed again..
11 ../util/yaz-marcdump -i marcxml >/dev/null 2>&1
12 if test $? = "3"; then
20 for f in ${srcdir}/marc[0-9].marc; do
21 fb=`basename ${f} .marc`
22 CHR=`cat ${srcdir}/${fb}.chr`
23 NEW=${PREFIX}${fb}.new.xml
24 OLD=${srcdir}/${PREFIX}${fb}.xml
25 DIFF=`basename ${f}`.diff
26 #echo "../util/yaz-marcdump -f $CHR -t utf-8 -i marc -o ${OUTPUT_FORMAT} $f > $NEW"
27 ../util/yaz-marcdump -f $CHR -t utf-8 -i marc -o ${OUTPUT_FORMAT} $f > $NEW
28 if test $? != "0"; then
29 echo "$f: yaz-marcdump returned error"
31 elif test -f $OLD; then
32 if diff $OLD $NEW >$DIFF; then
36 echo "$f: $NEW and $OLD differ"
40 echo "$f: Making test result $OLD for the first time"
41 if test -x /usr/bin/xmllint; then
42 if xmllint --noout $NEW >out 2>stderr; then
43 echo "$f: $NEW is well-formed"
46 echo "$f: $NEW not well-formed"
50 echo "xmllint not found. install libxml2-utils"
55 if test -z "$noxml"; then
58 # compare with original (binary) marc record.
60 NEW=`basename ${f}`.new.marc
61 DIFF=`basename ${f}`.diff
62 ../util/yaz-marcdump -f utf-8 -t utf-8 -i ${REVERT_FORMAT} -o marc $f > $NEW
63 if test $? != "0"; then
64 echo "Failed decode of $f"
66 elif test -f $OLD; then
67 # echo "diff $OLD $NEW "
68 if diff $OLD $NEW >$DIFF; then
72 echo "$f: $NEW and $OLD Differ"
76 echo "$f: Making test result $OLD for the first time"
80 REVERT=`basename ${f}`.marc.revert
81 #../util/yaz-marcdump -f utf-8 -t $CHR -i ${REVERT_FORMAT} -o marc $f > $REVERT
82 #hexdump -cx $REVERT > $REVERT.hex
83 #hexdump -cx $ORIGINAL > $ORIGINAL.hex
84 #diff $REVERT.hex $ORIGINAL.hex > $REVERT.diff
90 binmarc_convert "marcxml" "marcxml" ""
91 echo "binmarc -> marcxml: $?"
93 binmarc_convert "xml,marcxml" "marcxml" "xml2"
94 echo "binmarc -> marcxml(libxml2): $?"
96 binmarc_convert "tmarcxml" "tmarcxml" "t"
97 echo "binmarc -> tmarcxml: $?"
99 binmarc_convert "xml,tmarcxml" "tmarcxml" "xml2t"
100 echo "binmarc -> tmarcxml(libxml2): $?"