2 # $Id: tstmarc.sh,v 1.4 2007-09-25 07:34:03 adam Exp $
3 # Tests reading of ISO2709 and checks that we get identical MARCXML
5 # Reads marc?.marc files , Generates marc*.xml files
6 # If Libxml2 is present, the marc*.xml files are parsed again..
10 ../util/yaz-marcdump -i marcxml >/dev/null 2>&1
11 if test $? = "3"; then
15 for f in ${srcdir}/marc[0-9].marc; do
16 fb=`basename ${f} .marc`
17 CHR=${srcdir}/${fb}.chr
19 OLD=${srcdir}/${fb}.xml
20 DIFF=`basename ${f}`.diff
21 ../util/yaz-marcdump -f `cat $CHR` -t utf-8 -o marcxml $f > $NEW
22 if test $? != "0"; then
23 echo "$f: yaz-marcdump returned error"
25 elif test -f $OLD; then
26 if diff $OLD $NEW >$DIFF; then
30 echo "$f: $NEW and $OLD differ"
34 echo "$f: Making test result $OLD for the first time"
35 if test -x /usr/bin/xmllint; then
36 if xmllint --noout $NEW >out 2>stderr; then
37 echo "$f: $NEW is well-formed"
40 echo "$f: $NEW not well-formed"
44 echo "xmllint not found. install libxml2-utils"
49 if test -z "$noxml"; then
52 NEW=`basename ${f}`.new.marc
53 DIFF=`basename ${f}`.diff
54 ../util/yaz-marcdump -f utf-8 -t utf-8 -i marcxml -o marc $f > $NEW
55 if test $? != "0"; then
56 echo "Failed decode of $f"
58 elif test -f $OLD; then
59 if diff $OLD $NEW >$DIFF; then
63 echo "$f: $NEW and $OLD Differ"
67 echo "$f: Making test result $OLD for the first time"