From: Adam Dickmeiss Date: Wed, 4 May 2011 13:09:33 +0000 (+0200) Subject: Renamed sh-based tests X-Git-Tag: v4.2.0~36 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=b756b711841bac38e5b69baa51939ca9e1c01adb Renamed sh-based tests --- diff --git a/test/Makefile.am b/test/Makefile.am index 5e92f72..4751d2e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -9,7 +9,8 @@ check_PROGRAMS = test_xmalloc test_iconv test_nmem test_matchstr test_wrbuf \ test_rpn2cql test_rpn2solr test_json test_xml_include test_file_glob \ test_shared_ptr test_libstemmer -check_SCRIPTS = tstmarc.sh tstmarccol.sh tstcql2xcql.sh tstcql2pqf.sh tsticu.sh +check_SCRIPTS = test_marc.sh test_marccol.sh test_cql2xcql.sh \ + test_cql2pqf.sh test_icu.sh TESTS = $(check_PROGRAMS) $(check_SCRIPTS) @@ -21,9 +22,10 @@ EXTRA_DIST = tstodr.asn test_odrcodec.c test_odrcodec.h cql2xcqlsample \ marccol3.u8.marc marccol3.u8.1.lst marccol3.u8.2.lst \ marccol4.u8.marc marccol4.u8.1.lst marccol4.u8.2.lst \ marccol5.u8.marc marccol5.u8.1.lst marccol5.u8.2.lst \ - tsticu-0.xml tsticu-0.input tsticu-0.output \ - tsticu-1.xml tsticu-1.input tsticu-1.output \ - tsticu-2.xml tsticu-2.input tsticu-2.output \ + test_icu.0.xml test_icu.0.input test_icu.0.output \ + test_icu.1.xml test_icu.1.input test_icu.1.output \ + test_icu.2.xml test_icu.2.input test_icu.2.output \ + test_icu.3.xml test_icu.3.input test_icu.3.output \ test_record_conv.xsl test_xml_include.xml YAZCOMP = ../util/yaz-asncomp diff --git a/test/test_cql2pqf.sh b/test/test_cql2pqf.sh new file mode 100755 index 0000000..052b8e4 --- /dev/null +++ b/test/test_cql2pqf.sh @@ -0,0 +1,54 @@ +#!/bin/sh +srcdir=${srcdir:-.} +oIFS="$IFS" +IFS=' +' +secno=0 +testno=0 +comment=0 +ecode=0 +test -f ${srcdir}/cql2pqfsample || exit 1 +test -d cql2pqf || mkdir cql2pqf +for f in `cat ${srcdir}/cql2pqfsample`; do + if echo $f | grep '^#' >/dev/null; then + comment=1 + else + if test "$comment" = "1"; then + secno=`expr $secno + 1` + testno=0 + fi + comment=0 + testno=`expr $testno + 1` + OUT1=${srcdir}/cql2pqf/$secno.$testno.out + ERR1=${srcdir}/cql2pqf/$secno.$testno.err + OUT2=cql2pqf/$secno.$testno.out.tmp + ERR2=cql2pqf/$secno.$testno.err.tmp + DIFF=cql2pqf/$secno.$testno.diff + ../util/cql2pqf ${srcdir}/../etc/pqf.properties "$f" >$OUT2 2>$ERR2 + if test -f $OUT1 -a -f $ERR1; then + if diff $OUT1 $OUT2 >$DIFF; then + rm $DIFF + rm $OUT2 + else + echo "diff out $secno $testno $f" + cat $DIFF + ecode=1 + fi + if diff $ERR1 $ERR2 >$DIFF; then + rm $DIFF + rm $ERR2 + else + echo "diff err $secno $testno $f" + cat $DIFF + ecode=1 + fi + else + echo "making test $secno $testno $f" + mv $OUT2 $OUT1 + mv $ERR2 $ERR1 + ecode=1 + fi + fi +done +IFS="$oIFS" +exit $ecode diff --git a/test/test_cql2xcql.sh b/test/test_cql2xcql.sh new file mode 100755 index 0000000..0085c23 --- /dev/null +++ b/test/test_cql2xcql.sh @@ -0,0 +1,54 @@ +#!/bin/sh +srcdir=${srcdir:-.} +oIFS="$IFS" +IFS=' +' +secno=0 +testno=0 +comment=0 +ecode=0 +test -f ${srcdir}/cql2xcqlsample || exit 1 +test -d cql || mkdir cql +for f in `cat ${srcdir}/cql2xcqlsample`; do + if echo $f | grep '^#' >/dev/null; then + comment=1 + else + if test "$comment" = "1"; then + secno=`expr $secno + 1` + testno=0 + fi + comment=0 + testno=`expr $testno + 1` + OUT1=${srcdir}/cql/$secno.$testno.out + ERR1=${srcdir}/cql/$secno.$testno.err + OUT2=cql/$secno.$testno.out.tmp + ERR2=cql/$secno.$testno.err.tmp + DIFF=cql/$secno.$testno.diff + ../util/cql2xcql "$f" >$OUT2 2>$ERR2 + if test -f $OUT1 -a -f $ERR1; then + if diff $OUT1 $OUT2 >$DIFF; then + rm $DIFF + rm $OUT2 + else + echo "diff out $secno $testno $f" + cat $DIFF + ecode=1 + fi + if diff $ERR1 $ERR2 >$DIFF; then + rm $DIFF + rm $ERR2 + else + echo "diff err $secno $testno $f" + cat $DIFF + ecode=1 + fi + else + echo "making test $secno $testno $f" + mv $OUT2 $OUT1 + mv $ERR2 $ERR1 + ecode=1 + fi + fi +done +IFS="$oIFS" +exit $ecode diff --git a/test/test_icu.0.input b/test/test_icu.0.input new file mode 100644 index 0000000..6e4709c --- /dev/null +++ b/test/test_icu.0.input @@ -0,0 +1,4 @@ +Børn +Le Carré +Le Carre +Le Carré diff --git a/test/test_icu.0.output b/test/test_icu.0.output new file mode 100644 index 0000000..2a9dc2e --- /dev/null +++ b/test/test_icu.0.output @@ -0,0 +1,7 @@ +1 1 'børn' 'Børn' +2 2 'le' 'Le' +3 2 'carré' 'Carré' +4 3 'le' 'Le' +5 3 'carre' 'Carre' +6 4 'le' 'Le' +7 4 'carré' 'Carré' diff --git a/test/test_icu.0.xml b/test/test_icu.0.xml new file mode 100644 index 0000000..537cc9b --- /dev/null +++ b/test/test_icu.0.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/test_icu.1.input b/test/test_icu.1.input new file mode 100644 index 0000000..6e4709c --- /dev/null +++ b/test/test_icu.1.input @@ -0,0 +1,4 @@ +Børn +Le Carré +Le Carre +Le Carré diff --git a/test/test_icu.1.output b/test/test_icu.1.output new file mode 100644 index 0000000..78b2967 --- /dev/null +++ b/test/test_icu.1.output @@ -0,0 +1,7 @@ +1 1 'børn' 'Børn' +2 2 'le' 'Le' +3 2 'carre' 'Carre' +4 3 'le' 'Le' +5 3 'carre' 'Carre' +6 4 'le' 'Le' +7 4 'carre' 'Carre' diff --git a/test/test_icu.1.xml b/test/test_icu.1.xml new file mode 100644 index 0000000..581bc51 --- /dev/null +++ b/test/test_icu.1.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/test_icu.2.input b/test/test_icu.2.input new file mode 100644 index 0000000..579a976 --- /dev/null +++ b/test/test_icu.2.input @@ -0,0 +1,2 @@ +`a' +``a'' diff --git a/test/test_icu.2.output b/test/test_icu.2.output new file mode 100644 index 0000000..b5ee584 --- /dev/null +++ b/test/test_icu.2.output @@ -0,0 +1,4 @@ +1 1 '‘a' +' '' +2 2 '“a'' +' '' diff --git a/test/test_icu.2.xml b/test/test_icu.2.xml new file mode 100644 index 0000000..eea85bd --- /dev/null +++ b/test/test_icu.2.xml @@ -0,0 +1,8 @@ + + +$back = \` ; +$back $back > “ ; # generate right d.q.m. (double quotation mark) +$back > ‘ ; + + + diff --git a/test/test_icu.3.input b/test/test_icu.3.input new file mode 100644 index 0000000..989f89d --- /dev/null +++ b/test/test_icu.3.input @@ -0,0 +1,2 @@ +men running +he runs diff --git a/test/test_icu.3.output b/test/test_icu.3.output new file mode 100644 index 0000000..3139c0b --- /dev/null +++ b/test/test_icu.3.output @@ -0,0 +1,4 @@ +1 1 'men' '' +2 1 'run' '' +3 2 'he' '' +4 2 'run' '' diff --git a/test/test_icu.3.xml b/test/test_icu.3.xml new file mode 100644 index 0000000..f7db5c7 --- /dev/null +++ b/test/test_icu.3.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/test_icu.sh b/test/test_icu.sh new file mode 100755 index 0000000..06b50f9 --- /dev/null +++ b/test/test_icu.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Tests a couple of yaz-icu conversions +# +# Reads tsticu-[0-9].input files +# Writes tsticu-[0-9].output / output.tmp files +# Config tsticu-[0-9].xml + +srcdir=${srcdir:-.} +ecode=0 + +../util/yaz-icu >/dev/null 2>&1 +if test $? = "3"; then + exit 0 +fi + +for f in ${srcdir}/test_icu.[0-9].input; do + fb=`basename ${f} .input` + CONFIG=${srcdir}/${fb}.xml + NEW=${fb}.output.tmp + OLD=${srcdir}/${fb}.output + DIFF=`basename ${fb}`.diff + ../util/yaz-icu -c $CONFIG <$f > $NEW + if test $? != "0"; then + echo "$f: yaz-icu 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" + mv $NEW $OLD + ecode=1 + fi +done +exit $ecode + +# Local Variables: +# mode:shell-script +# sh-indentation: 2 +# sh-basic-offset: 4 +# End: diff --git a/test/test_marc.sh b/test/test_marc.sh new file mode 100755 index 0000000..2996bb4 --- /dev/null +++ b/test/test_marc.sh @@ -0,0 +1,118 @@ +#!/bin/sh +# Tests reading of ISO2709 and checks that we get identical MARCXML +# +# Reads marc?.marc files , Generates marc*.xml files +# If Libxml2 is present, also turbomarc*xml. +# as well as reverse transformation from *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 + +../util/yaz-marcdump -o xml,marcxml >/dev/null 2>&1 +if test $? = "4"; then + noxmlwrite=1 +fi + +binmarc_convert() { + OUTPUT_FORMAT="$1" + REVERT_FORMAT="$2" + PREFIX="$3" + for f in ${srcdir}/marc[0-9].marc; do + fb=`basename ${f} .marc` + CHR=`cat ${srcdir}/${fb}.chr` + NEW=${PREFIX}${fb}.new.xml + OLD=${srcdir}/${PREFIX}${fb}.xml + DIFF=`basename ${f}`.diff + #echo "../util/yaz-marcdump -f $CHR -t utf-8 -i marc -o ${OUTPUT_FORMAT} $f > $NEW" + ../util/yaz-marcdump -f $CHR -t utf-8 -i marc -o ${OUTPUT_FORMAT} $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 + ORIGINAL=${f} + f=$OLD + # compare with original (binary) marc record. + OLD=${f}.marc + NEW=`basename ${f}`.new.marc + DIFF=`basename ${f}`.diff + #echo "../util/yaz-marcdump -f utf-8 -t utf-8 -i ${REVERT_FORMAT} -o marc $f > $NEW" + ../util/yaz-marcdump -f utf-8 -t utf-8 -i ${REVERT_FORMAT} -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 + # check with original + REVERT=`basename ${f}`.marc.revert + #../util/yaz-marcdump -f utf-8 -t $CHR -i ${REVERT_FORMAT} -o marc $f > $REVERT + #hexdump -cx $REVERT > $REVERT.hex + #hexdump -cx $ORIGINAL > $ORIGINAL.hex + #diff $REVERT.hex $ORIGINAL.hex > $REVERT.diff + fi + done + return $ecode +} + +binmarc_convert "marcxml" "marcxml" "" +echo "binmarc -> marcxml: $?" + + +if test -z "$noxmlwrite"; then +binmarc_convert "xml,marcxml" "marcxml" "xml2" +echo "binmarc -> marcxml(libxml2): $?" +fi + +binmarc_convert "turbomarc" "turbomarc" "t" +echo "binmarc -> turbomarc: $?" + +if test -z "$noxmlwrite"; then +binmarc_convert "xml,turbomarc" "turbomarc" "xml2t" +echo "binmarc -> turbomarc(libxml2): $?" +fi + +exit $ecode + +# Local Variables: +# mode:shell-script +# sh-indentation: 2 +# sh-basic-offset: 4 +# End: diff --git a/test/test_marccol.sh b/test/test_marccol.sh new file mode 100755 index 0000000..63031b7 --- /dev/null +++ b/test/test_marccol.sh @@ -0,0 +1,65 @@ +#!/bin/sh +# Tests reading of a bunch of non-roman UTF-8 ISO2709 and see if +# we can encode it in MARC-8 +# +# Reads marccol?.u8.marc files , Generates marccol?.u8.{1,2}.lst +srcdir=${srcdir:-.} +ecode=0 +for f in ${srcdir}/marccol?.u8.marc; do + + fb=`basename ${f} .marc` + + DIFF=${fb}.1.lst.diff + NEW=${fb}.1.lst.new + OLD=${srcdir}/${fb}.1.lst + ../util/yaz-marcdump -f utf-8 -t utf-8 $f >$NEW + if test $? != "0"; then + echo "$f: yaz-marcdump returned error" + ecode=1 + break + 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 + + filem=`echo $fb | sed 's/u8/m8/'`.marc + ../util/yaz-marcdump -o marc -f utf8 -t marc8lossless $f >$filem + + DIFF=${fb}.2.lst.diff + NEW=${fb}.2.lst.new + OLD=${srcdir}/${fb}.2.lst + ../util/yaz-marcdump -f marc8 -t utf-8 $filem >$NEW + if test $? != "0"; then + echo "$f: yaz-marcdump returned error" + ecode=1 + break + elif test -f $OLD; then + if diff $OLD $NEW >$DIFF; then + rm $DIFF + rm $NEW + rm $filem + else + echo "$f: $NEW and $OLD differ" + ecode=1 + fi + else + echo "$f: Making test result $OLD for the first time" + mv $NEW $OLD + rm $filem + fi +done +exit $ecode + +# Local Variables: +# mode:shell-script +# sh-indentation: 2 +# sh-basic-offset: 4 +# End: diff --git a/test/tstcql2pqf.sh b/test/tstcql2pqf.sh deleted file mode 100755 index 052b8e4..0000000 --- a/test/tstcql2pqf.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -srcdir=${srcdir:-.} -oIFS="$IFS" -IFS=' -' -secno=0 -testno=0 -comment=0 -ecode=0 -test -f ${srcdir}/cql2pqfsample || exit 1 -test -d cql2pqf || mkdir cql2pqf -for f in `cat ${srcdir}/cql2pqfsample`; do - if echo $f | grep '^#' >/dev/null; then - comment=1 - else - if test "$comment" = "1"; then - secno=`expr $secno + 1` - testno=0 - fi - comment=0 - testno=`expr $testno + 1` - OUT1=${srcdir}/cql2pqf/$secno.$testno.out - ERR1=${srcdir}/cql2pqf/$secno.$testno.err - OUT2=cql2pqf/$secno.$testno.out.tmp - ERR2=cql2pqf/$secno.$testno.err.tmp - DIFF=cql2pqf/$secno.$testno.diff - ../util/cql2pqf ${srcdir}/../etc/pqf.properties "$f" >$OUT2 2>$ERR2 - if test -f $OUT1 -a -f $ERR1; then - if diff $OUT1 $OUT2 >$DIFF; then - rm $DIFF - rm $OUT2 - else - echo "diff out $secno $testno $f" - cat $DIFF - ecode=1 - fi - if diff $ERR1 $ERR2 >$DIFF; then - rm $DIFF - rm $ERR2 - else - echo "diff err $secno $testno $f" - cat $DIFF - ecode=1 - fi - else - echo "making test $secno $testno $f" - mv $OUT2 $OUT1 - mv $ERR2 $ERR1 - ecode=1 - fi - fi -done -IFS="$oIFS" -exit $ecode diff --git a/test/tstcql2xcql.sh b/test/tstcql2xcql.sh deleted file mode 100755 index 0085c23..0000000 --- a/test/tstcql2xcql.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -srcdir=${srcdir:-.} -oIFS="$IFS" -IFS=' -' -secno=0 -testno=0 -comment=0 -ecode=0 -test -f ${srcdir}/cql2xcqlsample || exit 1 -test -d cql || mkdir cql -for f in `cat ${srcdir}/cql2xcqlsample`; do - if echo $f | grep '^#' >/dev/null; then - comment=1 - else - if test "$comment" = "1"; then - secno=`expr $secno + 1` - testno=0 - fi - comment=0 - testno=`expr $testno + 1` - OUT1=${srcdir}/cql/$secno.$testno.out - ERR1=${srcdir}/cql/$secno.$testno.err - OUT2=cql/$secno.$testno.out.tmp - ERR2=cql/$secno.$testno.err.tmp - DIFF=cql/$secno.$testno.diff - ../util/cql2xcql "$f" >$OUT2 2>$ERR2 - if test -f $OUT1 -a -f $ERR1; then - if diff $OUT1 $OUT2 >$DIFF; then - rm $DIFF - rm $OUT2 - else - echo "diff out $secno $testno $f" - cat $DIFF - ecode=1 - fi - if diff $ERR1 $ERR2 >$DIFF; then - rm $DIFF - rm $ERR2 - else - echo "diff err $secno $testno $f" - cat $DIFF - ecode=1 - fi - else - echo "making test $secno $testno $f" - mv $OUT2 $OUT1 - mv $ERR2 $ERR1 - ecode=1 - fi - fi -done -IFS="$oIFS" -exit $ecode diff --git a/test/tsticu-0.input b/test/tsticu-0.input deleted file mode 100644 index 6e4709c..0000000 --- a/test/tsticu-0.input +++ /dev/null @@ -1,4 +0,0 @@ -Børn -Le Carré -Le Carre -Le Carré diff --git a/test/tsticu-0.output b/test/tsticu-0.output deleted file mode 100644 index 2a9dc2e..0000000 --- a/test/tsticu-0.output +++ /dev/null @@ -1,7 +0,0 @@ -1 1 'børn' 'Børn' -2 2 'le' 'Le' -3 2 'carré' 'Carré' -4 3 'le' 'Le' -5 3 'carre' 'Carre' -6 4 'le' 'Le' -7 4 'carré' 'Carré' diff --git a/test/tsticu-0.xml b/test/tsticu-0.xml deleted file mode 100644 index 537cc9b..0000000 --- a/test/tsticu-0.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/test/tsticu-1.input b/test/tsticu-1.input deleted file mode 100644 index 6e4709c..0000000 --- a/test/tsticu-1.input +++ /dev/null @@ -1,4 +0,0 @@ -Børn -Le Carré -Le Carre -Le Carré diff --git a/test/tsticu-1.output b/test/tsticu-1.output deleted file mode 100644 index 78b2967..0000000 --- a/test/tsticu-1.output +++ /dev/null @@ -1,7 +0,0 @@ -1 1 'børn' 'Børn' -2 2 'le' 'Le' -3 2 'carre' 'Carre' -4 3 'le' 'Le' -5 3 'carre' 'Carre' -6 4 'le' 'Le' -7 4 'carre' 'Carre' diff --git a/test/tsticu-1.xml b/test/tsticu-1.xml deleted file mode 100644 index 581bc51..0000000 --- a/test/tsticu-1.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/test/tsticu-2.input b/test/tsticu-2.input deleted file mode 100644 index 579a976..0000000 --- a/test/tsticu-2.input +++ /dev/null @@ -1,2 +0,0 @@ -`a' -``a'' diff --git a/test/tsticu-2.output b/test/tsticu-2.output deleted file mode 100644 index b5ee584..0000000 --- a/test/tsticu-2.output +++ /dev/null @@ -1,4 +0,0 @@ -1 1 '‘a' -' '' -2 2 '“a'' -' '' diff --git a/test/tsticu-2.xml b/test/tsticu-2.xml deleted file mode 100644 index eea85bd..0000000 --- a/test/tsticu-2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -$back = \` ; -$back $back > “ ; # generate right d.q.m. (double quotation mark) -$back > ‘ ; - - - diff --git a/test/tsticu-3.input b/test/tsticu-3.input deleted file mode 100644 index 989f89d..0000000 --- a/test/tsticu-3.input +++ /dev/null @@ -1,2 +0,0 @@ -men running -he runs diff --git a/test/tsticu-3.output b/test/tsticu-3.output deleted file mode 100644 index 3139c0b..0000000 --- a/test/tsticu-3.output +++ /dev/null @@ -1,4 +0,0 @@ -1 1 'men' '' -2 1 'run' '' -3 2 'he' '' -4 2 'run' '' diff --git a/test/tsticu-3.xml b/test/tsticu-3.xml deleted file mode 100644 index f7db5c7..0000000 --- a/test/tsticu-3.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/test/tsticu.sh b/test/tsticu.sh deleted file mode 100755 index 1988355..0000000 --- a/test/tsticu.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# Tests a couple of yaz-icu conversions -# -# Reads tsticu-[0-9].input files -# Writes tsticu-[0-9].output / output.tmp files -# Config tsticu-[0-9].xml - -srcdir=${srcdir:-.} -ecode=0 - -../util/yaz-icu >/dev/null 2>&1 -if test $? = "3"; then - exit 0 -fi - -for f in ${srcdir}/tsticu-[0-9].input; do - fb=`basename ${f} .input` - CONFIG=${srcdir}/${fb}.xml - NEW=${fb}.output.tmp - OLD=${srcdir}/${fb}.output - DIFF=`basename ${fb}`.diff - ../util/yaz-icu -c $CONFIG <$f > $NEW - if test $? != "0"; then - echo "$f: yaz-icu 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" - mv $NEW $OLD - ecode=1 - fi -done -exit $ecode - -# Local Variables: -# mode:shell-script -# sh-indentation: 2 -# sh-basic-offset: 4 -# End: diff --git a/test/tstmarc.sh b/test/tstmarc.sh deleted file mode 100755 index 2996bb4..0000000 --- a/test/tstmarc.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -# Tests reading of ISO2709 and checks that we get identical MARCXML -# -# Reads marc?.marc files , Generates marc*.xml files -# If Libxml2 is present, also turbomarc*xml. -# as well as reverse transformation from *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 - -../util/yaz-marcdump -o xml,marcxml >/dev/null 2>&1 -if test $? = "4"; then - noxmlwrite=1 -fi - -binmarc_convert() { - OUTPUT_FORMAT="$1" - REVERT_FORMAT="$2" - PREFIX="$3" - for f in ${srcdir}/marc[0-9].marc; do - fb=`basename ${f} .marc` - CHR=`cat ${srcdir}/${fb}.chr` - NEW=${PREFIX}${fb}.new.xml - OLD=${srcdir}/${PREFIX}${fb}.xml - DIFF=`basename ${f}`.diff - #echo "../util/yaz-marcdump -f $CHR -t utf-8 -i marc -o ${OUTPUT_FORMAT} $f > $NEW" - ../util/yaz-marcdump -f $CHR -t utf-8 -i marc -o ${OUTPUT_FORMAT} $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 - ORIGINAL=${f} - f=$OLD - # compare with original (binary) marc record. - OLD=${f}.marc - NEW=`basename ${f}`.new.marc - DIFF=`basename ${f}`.diff - #echo "../util/yaz-marcdump -f utf-8 -t utf-8 -i ${REVERT_FORMAT} -o marc $f > $NEW" - ../util/yaz-marcdump -f utf-8 -t utf-8 -i ${REVERT_FORMAT} -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 - # check with original - REVERT=`basename ${f}`.marc.revert - #../util/yaz-marcdump -f utf-8 -t $CHR -i ${REVERT_FORMAT} -o marc $f > $REVERT - #hexdump -cx $REVERT > $REVERT.hex - #hexdump -cx $ORIGINAL > $ORIGINAL.hex - #diff $REVERT.hex $ORIGINAL.hex > $REVERT.diff - fi - done - return $ecode -} - -binmarc_convert "marcxml" "marcxml" "" -echo "binmarc -> marcxml: $?" - - -if test -z "$noxmlwrite"; then -binmarc_convert "xml,marcxml" "marcxml" "xml2" -echo "binmarc -> marcxml(libxml2): $?" -fi - -binmarc_convert "turbomarc" "turbomarc" "t" -echo "binmarc -> turbomarc: $?" - -if test -z "$noxmlwrite"; then -binmarc_convert "xml,turbomarc" "turbomarc" "xml2t" -echo "binmarc -> turbomarc(libxml2): $?" -fi - -exit $ecode - -# Local Variables: -# mode:shell-script -# sh-indentation: 2 -# sh-basic-offset: 4 -# End: diff --git a/test/tstmarccol.sh b/test/tstmarccol.sh deleted file mode 100755 index 63031b7..0000000 --- a/test/tstmarccol.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# Tests reading of a bunch of non-roman UTF-8 ISO2709 and see if -# we can encode it in MARC-8 -# -# Reads marccol?.u8.marc files , Generates marccol?.u8.{1,2}.lst -srcdir=${srcdir:-.} -ecode=0 -for f in ${srcdir}/marccol?.u8.marc; do - - fb=`basename ${f} .marc` - - DIFF=${fb}.1.lst.diff - NEW=${fb}.1.lst.new - OLD=${srcdir}/${fb}.1.lst - ../util/yaz-marcdump -f utf-8 -t utf-8 $f >$NEW - if test $? != "0"; then - echo "$f: yaz-marcdump returned error" - ecode=1 - break - 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 - - filem=`echo $fb | sed 's/u8/m8/'`.marc - ../util/yaz-marcdump -o marc -f utf8 -t marc8lossless $f >$filem - - DIFF=${fb}.2.lst.diff - NEW=${fb}.2.lst.new - OLD=${srcdir}/${fb}.2.lst - ../util/yaz-marcdump -f marc8 -t utf-8 $filem >$NEW - if test $? != "0"; then - echo "$f: yaz-marcdump returned error" - ecode=1 - break - elif test -f $OLD; then - if diff $OLD $NEW >$DIFF; then - rm $DIFF - rm $NEW - rm $filem - else - echo "$f: $NEW and $OLD differ" - ecode=1 - fi - else - echo "$f: Making test result $OLD for the first time" - mv $NEW $OLD - rm $filem - fi -done -exit $ecode - -# Local Variables: -# mode:shell-script -# sh-indentation: 2 -# sh-basic-offset: 4 -# End: