]> granicus.if.org Git - libexpat/commitdiff
Added target to run checks based on xmlwf and James Clark's test cases.
authorFred L. Drake, Jr. <fdrake@users.sourceforge.net>
Mon, 29 Apr 2002 21:31:18 +0000 (21:31 +0000)
committerFred L. Drake, Jr. <fdrake@users.sourceforge.net>
Mon, 29 Apr 2002 21:31:18 +0000 (21:31 +0000)
This is not run by "make check" since it requires unzip, wget, and network
access to set up the tests.  Use "make run-xmltext" to run the tests.

expat/Makefile.in
expat/tests/.gitignore
expat/tests/xmltest.sh [new file with mode: 0755]

index 227492668c5dbfc68287f4e5d7a523c7dde1c7bf..0b256127df2ca4fd4e1da40fadc1559fdbeda8e5 100644 (file)
@@ -150,6 +150,15 @@ tests/runtests.o: tests/runtests.c tests/chardata.h
 tests/runtests: tests/runtests.o tests/chardata.o lib/$(LIBRARY)
        $(LINK_EXE) $^ -lcheck
 
+tests/xmltest.zip:
+       cd tests && wget ftp://ftp.jclark.com/pub/xml/xmltest.zip
+
+tests/xmltest: tests/xmltest.zip
+       cd tests && unzip -q xmltest.zip
+
+run-xmltest: xmlwf/xmlwf tests/xmltest
+       tests/xmltest.sh
+
 .SUFFIXES: .c .lo .o
 
 .c.o:
index 337b6517b8e875fcb5beb7b05136654538db4b14..d0a3c96f98e27ab7f0671c8dc750684776507c07 100644 (file)
@@ -1,3 +1,5 @@
 Makefile
 runtests
+xmltest
+xmltest.zip
 .libs
diff --git a/expat/tests/xmltest.sh b/expat/tests/xmltest.sh
new file mode 100755 (executable)
index 0000000..4be5a65
--- /dev/null
@@ -0,0 +1,48 @@
+#! /bin/sh
+
+VERBOSE=''
+
+if [ "$1" = '-v' -o "$1" = '--verbose' ] ; then
+    VERBOSE="$1"
+    shift
+fi
+
+if [ ! "$1" = '' ] ; then
+    ERRORS=0
+    if [ "$VERBOSE" ] ; then
+        OUTPUT="/tmp/$$.out"
+    else
+        OUTPUT="/dev/null"
+    fi
+    while [ "$1" ] ; do
+        FILE="`basename \"$1\"`"
+        DIR="`dirname \"$1\"`"
+        DIR="`dirname \"$DIR\"`"
+        ../xmlwf/xmlwf -d /tmp "$DIR/$FILE"
+        diff -u "$DIR/out/$FILE" "/tmp/$FILE" >$OUTPUT
+        ERR=$?
+        rm "/tmp/$FILE"
+        if [ ! "$ERR" = 0 ] ; then
+            ERRORS=`expr $ERRORS + 1`
+            echo "$DIR/$FILE ... Error"
+            cat $OUTPUT
+        elif [ "$VERBOSE" ] ; then
+            echo "$DIR/$FILE ... Ok"
+        fi
+        shift
+    done
+    if [ "$VERBOSE" ] ; then
+        rm $OUTPUT
+    fi
+    if [ ! "$ERRORS" = '0' ] ; then
+        echo "    Errors:  $ERRORS"
+        exit 1
+    fi
+else
+    SCRIPTDIR="`dirname \"$0\"`"
+    cd "$SCRIPTDIR"
+    find xmltest -name \*.xml | grep /out/ | xargs ./xmltest.sh $VERBOSE
+    if [ ! "$?" = "0" ] ; then
+        exit 1
+    fi
+fi