xmltest.sh (104349) | xmltest.sh (178848) |
---|---|
1#! /bin/sh 2 3# EXPAT TEST SCRIPT FOR W3C XML TEST SUITE 4 5# This script can be used to exercise Expat against the 6# w3c.org xml test suite, available from 7# http://www.w3.org/XML/Test/xmlts20020606.zip. 8 --- 17 unchanged lines hidden (view full) --- 26XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf" 27# XMLWF=/usr/local/bin/xmlwf 28TS="$MYDIR/XML-Test-Suite" 29# OUTPUT must terminate with the directory separator. 30OUTPUT="$TS/out/" 31# OUTPUT=/home/tmp/xml-testsuite-out/ 32 33 | 1#! /bin/sh 2 3# EXPAT TEST SCRIPT FOR W3C XML TEST SUITE 4 5# This script can be used to exercise Expat against the 6# w3c.org xml test suite, available from 7# http://www.w3.org/XML/Test/xmlts20020606.zip. 8 --- 17 unchanged lines hidden (view full) --- 26XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf" 27# XMLWF=/usr/local/bin/xmlwf 28TS="$MYDIR/XML-Test-Suite" 29# OUTPUT must terminate with the directory separator. 30OUTPUT="$TS/out/" 31# OUTPUT=/home/tmp/xml-testsuite-out/ 32 33 |
34# RunXmlwfNotWF file reldir 35# reldir includes trailing slash |
|
34RunXmlwfNotWF() { | 36RunXmlwfNotWF() { |
35 $XMLWF $1 $2 > outfile || return $? | 37 file="$1" 38 reldir="$2" 39 $XMLWF -p "$file" > outfile || return $? |
36 read outdata < outfile 37 if test "$outdata" = "" ; then | 40 read outdata < outfile 41 if test "$outdata" = "" ; then |
38 echo "Well formed: $3$2" | 42 echo "Expected well-formed: $reldir$file" |
39 return 1 40 else 41 return 0 42 fi 43} 44 | 43 return 1 44 else 45 return 0 46 fi 47} 48 |
49# RunXmlwfWF file reldir 50# reldir includes trailing slash |
|
45RunXmlwfWF() { | 51RunXmlwfWF() { |
46 $XMLWF $1 -d "$OUTPUT$3" $2 > outfile || return $? | 52 file="$1" 53 reldir="$2" 54 $XMLWF -p -d "$OUTPUT$reldir" "$file" > outfile || return $? |
47 read outdata < outfile 48 if test "$outdata" = "" ; then | 55 read outdata < outfile 56 if test "$outdata" = "" ; then |
49 if [ -f out/$2 ] ; then 50 diff "$OUTPUT$3$2" out/$2 > outfile | 57 if [ -f "out/$file" ] ; then 58 diff "$OUTPUT$reldir$file" "out/$file" > outfile |
51 if [ -s outfile ] ; then | 59 if [ -s outfile ] ; then |
52 cp outfile $OUTPUT$3${2}.diff 53 echo "Output differs: $3$2" | 60 cp outfile "$OUTPUT$reldir$file.diff" 61 echo "Output differs: $reldir$file" |
54 return 1 55 fi 56 fi 57 return 0 58 else | 62 return 1 63 fi 64 fi 65 return 0 66 else |
59 echo "In $3: $outdata" | 67 echo "In $reldir: $outdata" |
60 return 1 61 fi 62} 63 64SUCCESS=0 65ERROR=0 66 | 68 return 1 69 fi 70} 71 72SUCCESS=0 73ERROR=0 74 |
75UpdateStatus() { 76 if [ "$1" -eq 0 ] ; then 77 SUCCESS=`expr $SUCCESS + 1` 78 else 79 ERROR=`expr $ERROR + 1` 80 fi 81} 82 |
|
67########################## 68# well-formed test cases # 69########################## 70 71cd "$TS/xmlconf" | 83########################## 84# well-formed test cases # 85########################## 86 87cd "$TS/xmlconf" |
72for xmldir in ibm/valid/P*/ \ 73 ibm/invalid/P*/ \ 74 xmltest/valid/ext-sa/ \ 75 xmltest/valid/not-sa/ \ 76 xmltest/invalid/ \ 77 xmltest/invalid/not-sa/ \ 78 xmltest/valid/sa/ \ 79 sun/valid/ \ 80 sun/invalid/ ; do | 88for xmldir in ibm/valid/P* \ 89 ibm/invalid/P* \ 90 xmltest/valid/ext-sa \ 91 xmltest/valid/not-sa \ 92 xmltest/invalid \ 93 xmltest/invalid/not-sa \ 94 xmltest/valid/sa \ 95 sun/valid \ 96 sun/invalid ; do |
81 cd "$TS/xmlconf/$xmldir" 82 mkdir -p "$OUTPUT$xmldir" 83 for xmlfile in *.xml ; do | 97 cd "$TS/xmlconf/$xmldir" 98 mkdir -p "$OUTPUT$xmldir" 99 for xmlfile in *.xml ; do |
84 if RunXmlwfWF -p "$xmlfile" "$xmldir" ; then 85 SUCCESS=`expr $SUCCESS + 1` 86 else 87 ERROR=`expr $ERROR + 1` 88 fi | 100 RunXmlwfWF "$xmlfile" "$xmldir/" 101 UpdateStatus $? |
89 done 90 rm outfile 91done 92 93cd "$TS/xmlconf/oasis" | 102 done 103 rm outfile 104done 105 106cd "$TS/xmlconf/oasis" |
94mkdir -p "$OUTPUT"oasis/ | 107mkdir -p "$OUTPUT"oasis |
95for xmlfile in *pass*.xml ; do | 108for xmlfile in *pass*.xml ; do |
96 if RunXmlwfWF -p "$xmlfile" "oasis/" ; then 97 SUCCESS=`expr $SUCCESS + 1` 98 else 99 ERROR=`expr $ERROR + 1` 100 fi | 109 RunXmlwfWF "$xmlfile" "oasis/" 110 UpdateStatus $? |
101done 102rm outfile 103 104############################## 105# not well-formed test cases # 106############################## 107 108cd "$TS/xmlconf" | 111done 112rm outfile 113 114############################## 115# not well-formed test cases # 116############################## 117 118cd "$TS/xmlconf" |
109for xmldir in ibm/not-wf/P*/ \ 110 ibm/not-wf/misc/ \ 111 xmltest/not-wf/ext-sa/ \ 112 xmltest/not-wf/not-sa/ \ 113 xmltest/not-wf/sa/ \ 114 sun/not-wf/ ; do | 119for xmldir in ibm/not-wf/P* \ 120 ibm/not-wf/misc \ 121 xmltest/not-wf/ext-sa \ 122 xmltest/not-wf/not-sa \ 123 xmltest/not-wf/sa \ 124 sun/not-wf ; do |
115 cd "$TS/xmlconf/$xmldir" 116 for xmlfile in *.xml ; do | 125 cd "$TS/xmlconf/$xmldir" 126 for xmlfile in *.xml ; do |
117 if RunXmlwfNotWF -p "$xmlfile" "$xmldir" ; then 118 SUCCESS=`expr $SUCCESS + 1` 119 else 120 ERROR=`expr $ERROR + 1` 121 fi | 127 RunXmlwfNotWF "$xmlfile" "$xmldir/" 128 UpdateStatus $? |
122 done 123 rm outfile 124done 125 126cd "$TS/xmlconf/oasis" 127for xmlfile in *fail*.xml ; do | 129 done 130 rm outfile 131done 132 133cd "$TS/xmlconf/oasis" 134for xmlfile in *fail*.xml ; do |
128 if RunXmlwfNotWF -p "$xmlfile" "oasis/" ; then 129 SUCCESS=`expr $SUCCESS + 1` 130 else 131 ERROR=`expr $ERROR + 1` 132 fi | 135 RunXmlwfNotWF "$xmlfile" "oasis/" 136 UpdateStatus $? |
133done 134rm outfile 135 136echo "Passed: $SUCCESS" 137echo "Failed: $ERROR" | 137done 138rm outfile 139 140echo "Passed: $SUCCESS" 141echo "Failed: $ERROR" |