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 ../util/yaz-marcdump -f $CHR -t utf-8 -o ${OUTPUT_FORMAT} $f > $NEW
27 if test $? != "0"; then
28 echo "$f: yaz-marcdump returned error"
30 elif test -f $OLD; then
31 if diff $OLD $NEW >$DIFF; then
35 echo "$f: $NEW and $OLD differ"
39 echo "$f: Making test result $OLD for the first time"
40 if test -x /usr/bin/xmllint; then
41 if xmllint --noout $NEW >out 2>stderr; then
42 echo "$f: $NEW is well-formed"
45 echo "$f: $NEW not well-formed"
49 echo "xmllint not found. install libxml2-utils"
54 if test -z "$noxml"; then
57 # compare with original (binary) marc record.
59 NEW=`basename ${f}`.new.marc
60 DIFF=`basename ${f}`.diff
61 ../util/yaz-marcdump -f utf-8 -t utf-8 -i ${REVERT_FORMAT} -o marc $f > $NEW
62 if test $? != "0"; then
63 echo "Failed decode of $f"
65 elif test -f $OLD; then
66 # echo "diff $OLD $NEW "
67 if diff $OLD $NEW >$DIFF; then
71 echo "$f: $NEW and $OLD Differ"
75 echo "$f: Making test result $OLD for the first time"
79 REVERT=`basename ${f}`.marc.revert
80 #../util/yaz-marcdump -f utf-8 -t $CHR -i ${REVERT_FORMAT} -o marc $f > $REVERT
81 #hexdump -cx $REVERT > $REVERT.hex
82 #hexdump -cx $ORIGINAL > $ORIGINAL.hex
83 #diff $REVERT.hex $ORIGINAL.hex > $REVERT.diff
89 binmarc_convert "marcxml" "marcxml" ""
90 echo "binmarc -> marcxml: $?"
92 binmarc_convert "xml,marcxml" "marcxml" "xml2"
93 echo "binmarc -> marcxml(libxml2): $?"
95 binmarc_convert "xml,tmarcxml" "tmarcxml" "t"
96 echo "binmarc -> tmarcxml: $?"