]> granicus.if.org Git - docbook-dsssl/commitdiff
Shell script to run tests
authorNorman Walsh <ndw@nwalsh.com>
Wed, 31 Dec 2003 16:43:59 +0000 (16:43 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Wed, 31 Dec 2003 16:43:59 +0000 (16:43 +0000)
docbook/relaxng/tools/runtests [new file with mode: 0755]

diff --git a/docbook/relaxng/tools/runtests b/docbook/relaxng/tools/runtests
new file mode 100755 (executable)
index 0000000..7fa3649
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# This feels like a job Make ought to be able to do but I couldn't work it out...
+
+XMLFILES=$@
+SRCDIR=/sourceforge/docbook/testdocs/tests
+DB4UPG=../tools/db4-upgrade.xsl
+
+if [ ! -d passed ]; then
+    echo "Directory 'passed' must exist. Are you sure you're in the right place?"
+    exit 1
+fi
+
+
+if [ "$XMLFILES" = "" ]; then
+    for f in $SRCDIR/*.xml; do
+       XMLFILES="$XMLFILES `basename $f`"
+    done
+fi
+
+for f in $XMLFILES; do
+    REBUILD=1
+    if [ ! -f $SRCDIR/$f ]; then
+       REBUILD=0
+    fi
+
+    if [ -f $f -a $f -nt $SRCDIR/$f -a $f -nt $DB4UPG ]; then
+       REBUILD=0
+    fi
+
+    if [ -f passed/$f -a passed/$f -nt $SRCDIR/$f -a passed/$f -nt $DB4UPG ]; then
+       REBUILD=0
+    fi
+
+    if [ ! -f skip/$f ]; then
+
+       if [ "$REBUILD" != "0" ]; then
+           echo -n "Update $f..."
+           xsltproc --novalid --output $f $DB4UPG $SRCDIR/$f
+       fi
+
+       if [ ! -f passed/$f -o $f -nt passed/$f ]; then
+           echo -n "Validate $f..."
+           if jing ../docbook.rng $f; then
+               echo "passed"
+               mv $f passed/
+           else
+               echo "failed"
+           fi
+       fi
+
+    fi
+done
+