From 185d51016579faad34f8b62151ee1d5125a4d430 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 25 Sep 2007 07:34:03 +0000 Subject: [PATCH] Combine test from tstmarciso.sh and tstmarcxml.sh to tstmarc.sh .. Mostly because the latter requires output from the former (so make -j2 could break). --- test/Makefile.am | 4 +-- test/tstmarc.sh | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ test/tstmarciso.sh | 48 ------------------------------- test/tstmarcxml.sh | 40 -------------------------- 4 files changed, 81 insertions(+), 90 deletions(-) create mode 100755 test/tstmarc.sh delete mode 100755 test/tstmarciso.sh delete mode 100755 test/tstmarcxml.sh diff --git a/test/Makefile.am b/test/Makefile.am index b6ed006..40374ee 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,12 +1,12 @@ ## Copyright (C) 1995-2007, Index Data ApS ## All rights reserved. -## $Id: Makefile.am,v 1.36 2007-09-23 07:21:51 adam Exp $ +## $Id: Makefile.am,v 1.37 2007-09-25 07:34:03 adam Exp $ check_PROGRAMS = tsticonv tstnmem tstmatchstr tstwrbuf tstodr tstccl tstlog \ tstsoap1 tstsoap2 tstodrstack tstlogthread tstxmlquery tstpquery \ tst_comstack tst_filepath tst_record_conv tst_retrieval tst_tpath \ tst_timing tst_query_charset tst_oid -check_SCRIPTS = tstcql.sh tstmarciso.sh tstmarcxml.sh tstmarccol.sh +check_SCRIPTS = tstcql.sh tstmarc.sh tstmarccol.sh TESTS = $(check_PROGRAMS) $(check_SCRIPTS) diff --git a/test/tstmarc.sh b/test/tstmarc.sh new file mode 100755 index 0000000..b061adf --- /dev/null +++ b/test/tstmarc.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# $Id: tstmarc.sh,v 1.4 2007-09-25 07:34:03 adam Exp $ +# Tests reading of ISO2709 and checks that we get identical MARCXML +# +# Reads marc?.marc files , Generates marc*.xml files +# If Libxml2 is present, the marc*.xml files are parsed again.. +srcdir=${srcdir:-.} +ecode=0 + +../util/yaz-marcdump -i marcxml >/dev/null 2>&1 +if test $? = "3"; then + noxml=1 +fi + +for f in ${srcdir}/marc[0-9].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 $CHR` -t utf-8 -o marcxml $f > $NEW + if test $? != "0"; then + 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 "$f: $NEW and $OLD differ" + ecode=1 + fi + else + 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 "$f: $NEW is well-formed" + mv $NEW $OLD + else + echo "$f: $NEW not well-formed" + ecode=1 + fi + else + echo "xmllint not found. install libxml2-utils" + ecode=1 + fi + fi + + if test -z "$noxml"; then + f=$OLD + OLD=${f}.marc + NEW=`basename ${f}`.new.marc + DIFF=`basename ${f}`.diff + ../util/yaz-marcdump -f utf-8 -t utf-8 -i marcxml -o marc $f > $NEW + if test $? != "0"; then + echo "Failed decode of $f" + ecode=1 + elif test -f $OLD; then + if diff $OLD $NEW >$DIFF; then + rm $DIFF + rm $NEW + else + echo "$f: $NEW and $OLD Differ" + ecode=1 + fi + else + echo "$f: Making test result $OLD for the first time" + mv $NEW $OLD + fi + fi + +done +exit $ecode + +# Local Variables: +# mode:shell-script +# sh-indentation: 2 +# sh-basic-offset: 4 +# End: diff --git a/test/tstmarciso.sh b/test/tstmarciso.sh deleted file mode 100755 index 77d41a9..0000000 --- a/test/tstmarciso.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# $Id: tstmarciso.sh,v 1.5 2007-01-18 11:44:50 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?.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 $CHR` -t utf-8 -o marcxml $f > $NEW - if test $? != "0"; then - 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 "$f: $NEW and $OLD differ" - ecode=1 - fi - else - 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 "$f: $NEW is well-formed" - mv $NEW $OLD - else - echo "$f: $NEW not well-formed" - ecode=1 - fi - else - echo "xmllint not found. install libxml2-utils" - ecode=1 - fi - fi -done -exit $ecode - -# Local Variables: -# mode:shell-script -# sh-indentation: 2 -# sh-basic-offset: 4 -# End: diff --git a/test/tstmarcxml.sh b/test/tstmarcxml.sh deleted file mode 100755 index 34c81e4..0000000 --- a/test/tstmarcxml.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# $Id: tstmarcxml.sh,v 1.5 2007-02-17 10:53:05 adam Exp $ -# Tests reading of MARCXML and checks that we get identical ISO2709 output. -# -# Reads marc?.xml files , Generates marc?.xml.marc files -srcdir=${srcdir:-.} -ecode=0 -# Skip this test if Libxml2 support is not enabled -../util/yaz-marcdump -i marcxml >/dev/null 2>&1 -if test $? = "3"; then - exit 0 -fi -for f in ${srcdir}/marc?.xml; do - NEW=`basename ${f}`.new.marc - OLD=${f}.marc - DIFF=`basename ${f}`.diff - ../util/yaz-marcdump -f utf-8 -t utf-8 -i marcxml -o marc $f > $NEW - if test $? != "0"; then - echo "Failed decode of $f" - ecode=1 - elif test -f $OLD; then - if diff $OLD $NEW >$DIFF; then - rm $DIFF - rm $NEW - else - echo "$f: $NEW and $OLD Differ" - ecode=1 - fi - else - echo "$f: Making test result $OLD for the first time" - mv $NEW $OLD - fi -done -exit $ecode - -# Local Variables: -# mode:shell-script -# sh-indentation: 2 -# sh-basic-offset: 4 -# End: -- 1.7.10.4