2002-04-29 17:31:18 -04:00
|
|
|
#! /bin/sh
|
|
|
|
|
2002-09-03 19:19:30 -04:00
|
|
|
# EXPAT TEST SCRIPT FOR W3C XML TEST SUITE
|
2002-04-29 17:31:18 -04:00
|
|
|
|
2002-09-03 19:19:30 -04:00
|
|
|
# This script can be used to exercise Expat against the
|
|
|
|
# w3c.org xml test suite, available from
|
|
|
|
# http://www.w3.org/XML/Test/xmlts20020606.zip.
|
2002-04-29 17:31:18 -04:00
|
|
|
|
2002-09-03 19:19:30 -04:00
|
|
|
# To run this script, first set XMLWF so that xmlwf can be
|
|
|
|
# found, then set the output directory with OUTPUT.
|
|
|
|
|
|
|
|
# The script lists all test cases where Expat shows a discrepancy
|
|
|
|
# from the expected result. Test cases where only the canonical
|
|
|
|
# output differs are prefixed with "Output differs:", and a diff file
|
|
|
|
# is generated in the appropriate subdirectory under $OUTPUT.
|
|
|
|
|
|
|
|
# If there are output files provided, the script will use
|
|
|
|
# output from xmlwf and compare the desired output against it.
|
|
|
|
# However, one has to take into account that the canonical output
|
|
|
|
# produced by xmlwf conforms to an older definition of canonical XML
|
|
|
|
# and does not generate notation declarations.
|
|
|
|
|
|
|
|
MYDIR="`dirname \"$0\"`"
|
|
|
|
cd "$MYDIR"
|
|
|
|
MYDIR="`pwd`"
|
|
|
|
XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf"
|
|
|
|
# XMLWF=/usr/local/bin/xmlwf
|
|
|
|
TS="$MYDIR/XML-Test-Suite"
|
2002-09-03 23:04:44 -04:00
|
|
|
# OUTPUT must terminate with the directory separator.
|
2002-09-03 19:19:30 -04:00
|
|
|
OUTPUT="$TS/out/"
|
|
|
|
# OUTPUT=/home/tmp/xml-testsuite-out/
|
2002-09-03 23:04:44 -04:00
|
|
|
|
2002-09-03 19:19:30 -04:00
|
|
|
|
|
|
|
RunXmlwfNotWF() {
|
|
|
|
$XMLWF $1 $2 > outfile || return $?
|
|
|
|
read outdata < outfile
|
|
|
|
if test "$outdata" = "" ; then
|
|
|
|
echo "Well formed: $3$2"
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
RunXmlwfWF() {
|
|
|
|
$XMLWF $1 -d "$OUTPUT$3" $2 > outfile || return $?
|
|
|
|
read outdata < outfile
|
|
|
|
if test "$outdata" = "" ; then
|
|
|
|
if [ -f out/$2 ] ; then
|
|
|
|
diff "$OUTPUT$3$2" out/$2 > outfile
|
|
|
|
if [ -s outfile ] ; then
|
|
|
|
cp outfile $OUTPUT$3${2}.diff
|
|
|
|
echo "Output differs: $3$2"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo "In $3: $outdata"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
SUCCESS=0
|
|
|
|
ERROR=0
|
|
|
|
|
2002-09-03 23:04:44 -04:00
|
|
|
##########################
|
|
|
|
# well-formed test cases #
|
|
|
|
##########################
|
|
|
|
|
2002-09-03 19:19:30 -04:00
|
|
|
cd "$TS/xmlconf"
|
|
|
|
for xmldir in ibm/valid/P*/ \
|
2002-09-03 23:04:44 -04:00
|
|
|
ibm/invalid/P*/ \
|
2002-09-03 19:19:30 -04:00
|
|
|
xmltest/valid/ext-sa/ \
|
|
|
|
xmltest/valid/not-sa/ \
|
2002-09-03 23:04:44 -04:00
|
|
|
xmltest/invalid/ \
|
|
|
|
xmltest/invalid/not-sa/ \
|
2002-09-03 19:19:30 -04:00
|
|
|
xmltest/valid/sa/ \
|
2002-09-03 23:04:44 -04:00
|
|
|
sun/valid/ \
|
|
|
|
sun/invalid/ ; do
|
2002-09-03 19:19:30 -04:00
|
|
|
cd "$TS/xmlconf/$xmldir"
|
|
|
|
mkdir -p "$OUTPUT$xmldir"
|
|
|
|
for xmlfile in *.xml ; do
|
|
|
|
if RunXmlwfWF -p "$xmlfile" "$xmldir" ; then
|
|
|
|
SUCCESS=`expr $SUCCESS + 1`
|
|
|
|
else
|
|
|
|
ERROR=`expr $ERROR + 1`
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
rm outfile
|
|
|
|
done
|
|
|
|
|
|
|
|
cd "$TS/xmlconf/oasis"
|
|
|
|
mkdir -p "$OUTPUT"oasis/
|
|
|
|
for xmlfile in *pass*.xml ; do
|
|
|
|
if RunXmlwfWF -p "$xmlfile" "oasis/" ; then
|
|
|
|
SUCCESS=`expr $SUCCESS + 1`
|
2002-04-29 17:31:18 -04:00
|
|
|
else
|
2002-09-03 19:19:30 -04:00
|
|
|
ERROR=`expr $ERROR + 1`
|
2002-04-29 17:31:18 -04:00
|
|
|
fi
|
2002-09-03 19:19:30 -04:00
|
|
|
done
|
|
|
|
rm outfile
|
|
|
|
|
2002-09-03 23:04:44 -04:00
|
|
|
##############################
|
|
|
|
# not well-formed test cases #
|
|
|
|
##############################
|
|
|
|
|
2002-09-03 19:19:30 -04:00
|
|
|
cd "$TS/xmlconf"
|
|
|
|
for xmldir in ibm/not-wf/P*/ \
|
|
|
|
ibm/not-wf/misc/ \
|
|
|
|
xmltest/not-wf/ext-sa/ \
|
|
|
|
xmltest/not-wf/not-sa/ \
|
|
|
|
xmltest/not-wf/sa/ \
|
|
|
|
sun/not-wf/ ; do
|
|
|
|
cd "$TS/xmlconf/$xmldir"
|
|
|
|
for xmlfile in *.xml ; do
|
|
|
|
if RunXmlwfNotWF -p "$xmlfile" "$xmldir" ; then
|
|
|
|
SUCCESS=`expr $SUCCESS + 1`
|
|
|
|
else
|
|
|
|
ERROR=`expr $ERROR + 1`
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
rm outfile
|
|
|
|
done
|
|
|
|
|
|
|
|
cd "$TS/xmlconf/oasis"
|
|
|
|
for xmlfile in *fail*.xml ; do
|
|
|
|
if RunXmlwfNotWF -p "$xmlfile" "oasis/" ; then
|
|
|
|
SUCCESS=`expr $SUCCESS + 1`
|
|
|
|
else
|
|
|
|
ERROR=`expr $ERROR + 1`
|
2002-04-29 17:31:18 -04:00
|
|
|
fi
|
2002-09-03 19:19:30 -04:00
|
|
|
done
|
|
|
|
rm outfile
|
|
|
|
|
|
|
|
echo "Passed: $SUCCESS"
|
|
|
|
echo "Failed: $ERROR"
|