summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/expat/tests/xmltest.sh
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/expat/tests/xmltest.sh')
-rwxr-xr-x3rdparty/expat/tests/xmltest.sh32
1 files changed, 16 insertions, 16 deletions
diff --git a/3rdparty/expat/tests/xmltest.sh b/3rdparty/expat/tests/xmltest.sh
index 793a5cc2819..9b500351143 100755
--- a/3rdparty/expat/tests/xmltest.sh
+++ b/3rdparty/expat/tests/xmltest.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /usr/bin/env bash
# EXPAT TEST SCRIPT FOR W3C XML TEST SUITE
@@ -20,15 +20,18 @@
# produced by xmlwf conforms to an older definition of canonical XML
# and does not generate notation declarations.
+shopt -s nullglob
+
+# Note: OUTPUT must terminate with the directory separator.
+OUTPUT="$PWD/tests/out/"
+TS="$PWD/tests/"
+
MYDIR="`dirname \"$0\"`"
cd "$MYDIR"
MYDIR="`pwd`"
-XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf"
-# XMLWF=/usr/local/bin/xmlwf
-TS="$MYDIR/XML-Test-Suite"
-# OUTPUT must terminate with the directory separator.
-OUTPUT="$TS/out/"
-# OUTPUT=/home/tmp/xml-testsuite-out/
+XMLWF="${1:-`dirname \"$MYDIR\"`/xmlwf/xmlwf}"
+# Unicode-aware diff utility
+DIFF="${MYDIR}/udiffer.py"
# RunXmlwfNotWF file reldir
@@ -36,9 +39,7 @@ OUTPUT="$TS/out/"
RunXmlwfNotWF() {
file="$1"
reldir="$2"
- $XMLWF -p "$file" > outfile || return $?
- read outdata < outfile
- if test "$outdata" = "" ; then
+ if $XMLWF -p "$file" > /dev/null; then
echo "Expected not well-formed: $reldir$file"
return 1
else
@@ -51,11 +52,11 @@ RunXmlwfNotWF() {
RunXmlwfWF() {
file="$1"
reldir="$2"
- $XMLWF -p -d "$OUTPUT$reldir" "$file" > outfile || return $?
+ $XMLWF -p -N -d "$OUTPUT$reldir" "$file" > outfile || return $?
read outdata < outfile
if test "$outdata" = "" ; then
if [ -f "out/$file" ] ; then
- diff -u "$OUTPUT$reldir$file" "out/$file" > outfile
+ $DIFF "$OUTPUT$reldir$file" "out/$file" > outfile
if [ -s outfile ] ; then
cp outfile "$OUTPUT$reldir$file.diff"
echo "Output differs: $reldir$file"
@@ -96,11 +97,12 @@ for xmldir in ibm/valid/P* \
sun/invalid ; do
cd "$TS/xmlconf/$xmldir"
mkdir -p "$OUTPUT$xmldir"
- for xmlfile in *.xml ; do
+ for xmlfile in $(ls -1 *.xml | sort -d) ; do
+ [[ -f "$xmlfile" ]] || continue
RunXmlwfWF "$xmlfile" "$xmldir/"
UpdateStatus $?
done
- rm outfile
+ rm -f outfile
done
cd "$TS/xmlconf/oasis"
@@ -128,7 +130,6 @@ for xmldir in ibm/not-wf/P* \
RunXmlwfNotWF "$xmlfile" "$xmldir/"
UpdateStatus $?
done
- rm outfile
done
cd "$TS/xmlconf/oasis"
@@ -136,7 +137,6 @@ for xmlfile in *fail*.xml ; do
RunXmlwfNotWF "$xmlfile" "oasis/"
UpdateStatus $?
done
-rm outfile
echo "Passed: $SUCCESS"
echo "Failed: $ERROR"