[libxml2] Adding streaming validation to runtest checks



commit a7982ce272016182afafb6f74f3b312c6e5f7faf
Author: Daniel Veillard <veillard redhat com>
Date:   Thu Oct 25 15:39:39 2012 +0800

    Adding streaming validation to runtest checks

 result/VC/AttributeDefaultLegal.rdr         |   12 ++++++++++++
 result/VC/AttributeNmtokens.rdr             |    3 +++
 result/VC/DuplicateType.rdr                 |    3 +++
 result/VC/ElementValid.rdr                  |    3 +++
 result/VC/ElementValid2.rdr                 |    6 ++++++
 result/VC/ElementValid3.rdr                 |    6 ++++++
 result/VC/ElementValid4.rdr                 |    6 ++++++
 result/VC/ElementValid5.rdr                 |    6 ++++++
 result/VC/ElementValid6.rdr                 |    6 ++++++
 result/VC/ElementValid7.rdr                 |    6 ++++++
 result/VC/ElementValid8.rdr                 |    3 +++
 result/VC/Enumeration.rdr                   |    3 +++
 result/VC/NS2.rdr                           |    3 +++
 result/VC/NS3.rdr                           |    9 +++++++++
 result/VC/OneID.rdr                         |    6 ++++++
 result/VC/OneID2.rdr                        |    6 ++++++
 result/VC/OneID3.rdr                        |    6 ++++++
 result/VC/PENesting.rdr                     |    4 ++++
 result/VC/PENesting2.rdr                    |    4 ++++
 result/VC/UniqueElementTypeDeclaration.rdr  |    3 +++
 result/VC/UniqueElementTypeDeclaration2.rdr |    3 +++
 result/valid/rss.xml.err.rdr                |    3 +++
 result/valid/t4.dtd.err.rdr                 |    6 ++++++
 result/valid/t4a.dtd.err.rdr                |    6 ++++++
 result/valid/t6.dtd.err.rdr                 |    6 ++++++
 result/valid/t8.xml.err.rdr                 |   14 ++++++++++++++
 result/valid/t8a.xml.err.rdr                |   14 ++++++++++++++
 result/valid/xlink.xml.err.rdr              |    4 ++++
 runtest.c                                   |   22 ++++++++++++++++------
 29 files changed, 176 insertions(+), 6 deletions(-)
---
diff --git a/result/VC/AttributeDefaultLegal.rdr b/result/VC/AttributeDefaultLegal.rdr
new file mode 100644
index 0000000..6b61686
--- /dev/null
+++ b/result/VC/AttributeDefaultLegal.rdr
@@ -0,0 +1,12 @@
+./test/VC/AttributeDefaultLegal:4: validity error : Attribute doc of At: invalid default value
+<!ATTLIST doc At NMTOKEN "$$$">
+                              ^
+./test/VC/AttributeDefaultLegal:6: validity error : Attribute doc of bad: invalid default value
+<!ATTLIST doc bad IDREF "1abc_2">
+                                ^
+./test/VC/AttributeDefaultLegal:8: validity error : Attribute doc of bad2: invalid default value
+<!ATTLIST doc bad2 IDREFS "abc:1 1abc_2">
+                                        ^
+./test/VC/AttributeDefaultLegal:11: element doc: validity error : No declaration for attribute val of element doc
+<doc val="v1"/>
+             ^
diff --git a/result/VC/AttributeNmtokens.rdr b/result/VC/AttributeNmtokens.rdr
new file mode 100644
index 0000000..4c19285
--- /dev/null
+++ b/result/VC/AttributeNmtokens.rdr
@@ -0,0 +1,3 @@
+./test/VC/AttributeNmtokens:6: element test: validity error : Syntax of value for attribute attr1 of test is not valid
+<test attr1=" a&#x9;b "/>
+                       ^
diff --git a/result/VC/DuplicateType.rdr b/result/VC/DuplicateType.rdr
new file mode 100644
index 0000000..34e2c20
--- /dev/null
+++ b/result/VC/DuplicateType.rdr
@@ -0,0 +1,3 @@
+./test/VC/DuplicateType:3: validity error : Definition of a has duplicate references of c
+<!ELEMENT a (#PCDATA | b | c | d | c)*>
+                                       ^
diff --git a/result/VC/ElementValid.rdr b/result/VC/ElementValid.rdr
new file mode 100644
index 0000000..d6b50a7
--- /dev/null
+++ b/result/VC/ElementValid.rdr
@@ -0,0 +1,3 @@
+./test/VC/ElementValid:3: validity error : Validation failed: no DTD found !
+<doc/>
+    ^
diff --git a/result/VC/ElementValid2.rdr b/result/VC/ElementValid2.rdr
new file mode 100644
index 0000000..cae331b
--- /dev/null
+++ b/result/VC/ElementValid2.rdr
@@ -0,0 +1,6 @@
+./test/VC/ElementValid2:4: element p: validity error : No declaration for element p
+<doc><p/></doc>
+         ^
+./test/VC/ElementValid2:5: element p: validity error : No declaration for element p
+
+^
diff --git a/result/VC/ElementValid3.rdr b/result/VC/ElementValid3.rdr
new file mode 100644
index 0000000..5f4e03e
--- /dev/null
+++ b/result/VC/ElementValid3.rdr
@@ -0,0 +1,6 @@
+./test/VC/ElementValid3:4: element doc: validity error : Element doc was declared EMPTY this one has content
+<doc>Oops, this element was declared EMPTY</doc>
+                                                ^
+./test/VC/ElementValid3:5: element doc: validity error : Element doc was declared EMPTY this one has content
+
+^
diff --git a/result/VC/ElementValid4.rdr b/result/VC/ElementValid4.rdr
new file mode 100644
index 0000000..289a527
--- /dev/null
+++ b/result/VC/ElementValid4.rdr
@@ -0,0 +1,6 @@
+./test/VC/ElementValid4:7: element doc: validity error : Element c is not declared in doc list of possible children
+<doc> This <b>seems</b> Ok <a/> but this <c>was not declared</c></doc>
+                                                                      ^
+./test/VC/ElementValid4:8: element doc: validity error : Element c is not declared in doc list of possible children
+
+^
diff --git a/result/VC/ElementValid5.rdr b/result/VC/ElementValid5.rdr
new file mode 100644
index 0000000..899d759
--- /dev/null
+++ b/result/VC/ElementValid5.rdr
@@ -0,0 +1,6 @@
+./test/VC/ElementValid5:7: element doc: validity error : Element doc content does not follow the DTD, expecting (a , b* , c+), got (a b c b)
+<doc><a/><b> but this</b><c>was not declared</c><b>seems</b></doc>
+                                                                  ^
+./test/VC/ElementValid5:8: element doc: validity error : Element doc content does not follow the DTD, Misplaced b
+
+^
diff --git a/result/VC/ElementValid6.rdr b/result/VC/ElementValid6.rdr
new file mode 100644
index 0000000..aeafd6b
--- /dev/null
+++ b/result/VC/ElementValid6.rdr
@@ -0,0 +1,6 @@
+./test/VC/ElementValid6:7: element doc: validity error : Element doc content does not follow the DTD, expecting (a , b? , c+)?, got (a b)
+<doc><a/><b>lacks c</b></doc>
+                             ^
+./test/VC/ElementValid6:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more child
+
+^
diff --git a/result/VC/ElementValid7.rdr b/result/VC/ElementValid7.rdr
new file mode 100644
index 0000000..f001fd2
--- /dev/null
+++ b/result/VC/ElementValid7.rdr
@@ -0,0 +1,6 @@
+./test/VC/ElementValid7:7: element doc: validity error : Element doc content does not follow the DTD, expecting ((a | b)* , c+ , a , b? , c , a?), got (a b a c c a)
+<doc><a/><b/><a/><c/><c/><a/></doc>
+                                   ^
+./test/VC/ElementValid7:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more child
+
+^
diff --git a/result/VC/ElementValid8.rdr b/result/VC/ElementValid8.rdr
new file mode 100644
index 0000000..f1b0dad
--- /dev/null
+++ b/result/VC/ElementValid8.rdr
@@ -0,0 +1,3 @@
+./test/VC/ElementValid8:7: validity error : Content model of doc is not determinist: ((a , b) | (a , c))
+<doc><a/><c> doc is non-deterministic </c></doc>
+                                                ^
diff --git a/result/VC/Enumeration.rdr b/result/VC/Enumeration.rdr
new file mode 100644
index 0000000..30896fc
--- /dev/null
+++ b/result/VC/Enumeration.rdr
@@ -0,0 +1,3 @@
+./test/VC/Enumeration:5: element doc: validity error : Value "v4" for attribute val of doc is not among the enumerated set
+<doc val="v4"></doc>
+             ^
diff --git a/result/VC/NS1.rdr b/result/VC/NS1.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/VC/NS2.rdr b/result/VC/NS2.rdr
new file mode 100644
index 0000000..abd1f88
--- /dev/null
+++ b/result/VC/NS2.rdr
@@ -0,0 +1,3 @@
+./test/VC/NS2:9: element doc: validity error : No declaration for attribute attr of element doc
+<ns:doc ns:attr="val" xmlns:ns="http://www.example.org/test/";>
+                                                             ^
diff --git a/result/VC/NS3.rdr b/result/VC/NS3.rdr
new file mode 100644
index 0000000..72c0117
--- /dev/null
+++ b/result/VC/NS3.rdr
@@ -0,0 +1,9 @@
+./test/VC/NS3:9: element foo: validity error : Value for attribute xmlns of foo is different from default "http://example.com/fooo";
+xmlns="http://example.com/foo"; xmlns:foo="http://example.com/fo"; foo:info="toto"
+                                                                               ^
+./test/VC/NS3:9: element foo: validity error : Value for attribute xmlns of foo must be "http://example.com/fooo";
+xmlns="http://example.com/foo"; xmlns:foo="http://example.com/fo"; foo:info="toto"
+                                                                               ^
+./test/VC/NS3:9: element foo: validity error : Element foo namespace name for default namespace does not match the DTD
+mlns="http://example.com/foo"; xmlns:foo="http://example.com/fo"; foo:info="toto"/
+                                                                               ^
diff --git a/result/VC/OneID.rdr b/result/VC/OneID.rdr
new file mode 100644
index 0000000..a2c894f
--- /dev/null
+++ b/result/VC/OneID.rdr
@@ -0,0 +1,6 @@
+./test/VC/OneID:4: validity error : Element doc has too may ID attributes defined : id
+<!ATTLIST doc id ID #IMPLIED>
+                            ^
+./test/VC/OneID:4: validity error : Element doc has 2 ID attribute defined in the internal subset : id
+<!ATTLIST doc id ID #IMPLIED>
+                            ^
diff --git a/result/VC/OneID2.rdr b/result/VC/OneID2.rdr
new file mode 100644
index 0000000..2af04f1
--- /dev/null
+++ b/result/VC/OneID2.rdr
@@ -0,0 +1,6 @@
+./test/VC/OneID2:3: validity error : Element doc has too may ID attributes defined : id
+<!ATTLIST doc id ID #IMPLIED>
+                            ^
+./test/VC/OneID2:3: validity error : Element doc has 2 ID attribute defined in the internal subset : id
+<!ATTLIST doc id ID #IMPLIED>
+                            ^
diff --git a/result/VC/OneID3.rdr b/result/VC/OneID3.rdr
new file mode 100644
index 0000000..9accece
--- /dev/null
+++ b/result/VC/OneID3.rdr
@@ -0,0 +1,6 @@
+test/VC/dtds/doc.dtd:2: validity error : Element doc has too may ID attributes defined : val
+<!ATTLIST doc val ID #IMPLIED>
+                             ^
+test/VC/dtds/doc.dtd:2: validity error : Element doc has 2 ID attribute defined in the external subset : val
+<!ATTLIST doc val ID #IMPLIED>
+                             ^
diff --git a/result/VC/PENesting.rdr b/result/VC/PENesting.rdr
new file mode 100644
index 0000000..7f82e13
--- /dev/null
+++ b/result/VC/PENesting.rdr
@@ -0,0 +1,4 @@
+./test/VC/PENesting:1: parser error : StartTag: invalid element name
+<!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>"> 
+ ^
+./test/VC/PENesting : failed to parse
diff --git a/result/VC/PENesting2.rdr b/result/VC/PENesting2.rdr
new file mode 100644
index 0000000..71cb053
--- /dev/null
+++ b/result/VC/PENesting2.rdr
@@ -0,0 +1,4 @@
+./test/VC/PENesting2:1: parser error : StartTag: invalid element name
+<!ENTITY % p1 "(A|B">
+ ^
+./test/VC/PENesting2 : failed to parse
diff --git a/result/VC/UniqueElementTypeDeclaration.rdr b/result/VC/UniqueElementTypeDeclaration.rdr
new file mode 100644
index 0000000..8537041
--- /dev/null
+++ b/result/VC/UniqueElementTypeDeclaration.rdr
@@ -0,0 +1,3 @@
+test/VC/dtds/a.dtd:1: validity error : Redefinition of element a
+<!ELEMENT a (#PCDATA | b | c)*>
+                               ^
diff --git a/result/VC/UniqueElementTypeDeclaration2.rdr b/result/VC/UniqueElementTypeDeclaration2.rdr
new file mode 100644
index 0000000..c328d92
--- /dev/null
+++ b/result/VC/UniqueElementTypeDeclaration2.rdr
@@ -0,0 +1,3 @@
+./test/VC/UniqueElementTypeDeclaration2:6: validity error : Redefinition of element a
+<!ELEMENT a (#PCDATA | b | c)*>
+                               ^
diff --git a/result/valid/127772.xml.err.rdr b/result/valid/127772.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/REC-xml-19980210.xml.err.rdr b/result/valid/REC-xml-19980210.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/UTF16Entity.xml.err.rdr b/result/valid/UTF16Entity.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/dia.xml.err.rdr b/result/valid/dia.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/id1.xml.err.rdr b/result/valid/id1.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/id2.xml.err.rdr b/result/valid/id2.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/id3.xml.err.rdr b/result/valid/id3.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/index.xml.err.rdr b/result/valid/index.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/mixed_ns.xml.err.rdr b/result/valid/mixed_ns.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/notes.xml.err.rdr b/result/valid/notes.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/ns.xml.err.rdr b/result/valid/ns.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/ns2.xml.err.rdr b/result/valid/ns2.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/objednavka.xml.err.rdr b/result/valid/objednavka.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/rss.xml.err.rdr b/result/valid/rss.xml.err.rdr
new file mode 100644
index 0000000..2ec7c9e
--- /dev/null
+++ b/result/valid/rss.xml.err.rdr
@@ -0,0 +1,3 @@
+./test/valid/rss.xml:177: element rss: validity error : Element rss does not carry attribute version
+</rss>
+      ^
diff --git a/result/valid/t10.xml.err.rdr b/result/valid/t10.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/t11.xml.err.rdr b/result/valid/t11.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/t4.dtd.err.rdr b/result/valid/t4.dtd.err.rdr
new file mode 100644
index 0000000..23a3258
--- /dev/null
+++ b/result/valid/t4.dtd.err.rdr
@@ -0,0 +1,6 @@
+./test/valid/t4.dtd:1: parser error : StartTag: invalid element name
+<!ENTITY % percent "&#x25;">
+ ^
+./test/valid/t4.dtd:1: parser error : Extra content at the end of the document
+<!ENTITY % percent "&#x25;">
+ ^
diff --git a/result/valid/t4.xml.err.rdr b/result/valid/t4.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/t4a.dtd.err.rdr b/result/valid/t4a.dtd.err.rdr
new file mode 100644
index 0000000..48cdd5f
--- /dev/null
+++ b/result/valid/t4a.dtd.err.rdr
@@ -0,0 +1,6 @@
+./test/valid/t4a.dtd:1: parser error : StartTag: invalid element name
+<!ENTITY % percent "&#x25;">
+ ^
+./test/valid/t4a.dtd:1: parser error : Extra content at the end of the document
+<!ENTITY % percent "&#x25;">
+ ^
diff --git a/result/valid/t4a.xml.err.rdr b/result/valid/t4a.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/t6.dtd.err.rdr b/result/valid/t6.dtd.err.rdr
new file mode 100644
index 0000000..6e84d68
--- /dev/null
+++ b/result/valid/t6.dtd.err.rdr
@@ -0,0 +1,6 @@
+./test/valid/t6.dtd:1: parser error : StartTag: invalid element name
+<!ENTITY % xdef "def">
+ ^
+./test/valid/t6.dtd:1: parser error : Extra content at the end of the document
+<!ENTITY % xdef "def">
+ ^
diff --git a/result/valid/t6.xml.err.rdr b/result/valid/t6.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/t8.xml.err.rdr b/result/valid/t8.xml.err.rdr
new file mode 100644
index 0000000..c198a16
--- /dev/null
+++ b/result/valid/t8.xml.err.rdr
@@ -0,0 +1,14 @@
+Entity: line 1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+
+ %defroot; 
+          ^
+Entity: line 1: 
+&lt;!ELEMENT root (middle) >
+^
+Entity: line 1: parser error : DOCTYPE improperly terminated
+ %defroot; 
+          ^
+Entity: line 1: 
+&lt;!ELEMENT root (middle) >
+^
+./test/valid/t8.xml : failed to parse
diff --git a/result/valid/t8a.xml.err.rdr b/result/valid/t8a.xml.err.rdr
new file mode 100644
index 0000000..b6bdcbe
--- /dev/null
+++ b/result/valid/t8a.xml.err.rdr
@@ -0,0 +1,14 @@
+Entity: line 1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+
+ %defroot; 
+          ^
+Entity: line 1: 
+&lt;!ELEMENT root (middle) >
+^
+Entity: line 1: parser error : DOCTYPE improperly terminated
+ %defroot; 
+          ^
+Entity: line 1: 
+&lt;!ELEMENT root (middle) >
+^
+./test/valid/t8a.xml : failed to parse
diff --git a/result/valid/t9.xml.err.rdr b/result/valid/t9.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/t9a.xml.err.rdr b/result/valid/t9a.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/xhtml1.xhtml.err.rdr b/result/valid/xhtml1.xhtml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/xlink.xml.err.rdr b/result/valid/xlink.xml.err.rdr
new file mode 100644
index 0000000..38594f4
--- /dev/null
+++ b/result/valid/xlink.xml.err.rdr
@@ -0,0 +1,4 @@
+./test/valid/xlink.xml:450: element termdef: validity error : ID dt-arc already defined
+	<p><termdef id="dt-arc" term="Arc">An <ter
+	                                  ^
+validity error : attribute def line 199 references an unknown ID "dt-xlg"
diff --git a/runtest.c b/runtest.c
index c6517a3..ccdd49b 100644
--- a/runtest.c
+++ b/runtest.c
@@ -2093,7 +2093,7 @@ static void processNode(FILE *out, xmlTextReaderPtr reader) {
 }
 static int
 streamProcessTest(const char *filename, const char *result, const char *err,
-                  xmlTextReaderPtr reader, const char *rng) {
+                  xmlTextReaderPtr reader, const char *rng, int options) {
     int ret;
     char *temp = NULL;
     FILE *t = NULL;
@@ -2189,7 +2189,7 @@ streamParseTest(const char *filename, const char *result, const char *err,
     int ret;
 
     reader = xmlReaderForFile(filename, NULL, options);
-    ret = streamProcessTest(filename, result, err, reader, NULL);
+    ret = streamProcessTest(filename, result, err, reader, NULL, options);
     xmlFreeTextReader(reader);
     return(ret);
 }
@@ -2217,7 +2217,7 @@ walkerParseTest(const char *filename, const char *result, const char *err,
 	return(-1);
     }
     reader = xmlReaderWalker(doc);
-    ret = streamProcessTest(filename, result, err, reader, NULL);
+    ret = streamProcessTest(filename, result, err, reader, NULL, options);
     xmlFreeTextReader(reader);
     xmlFreeDoc(doc);
     return(ret);
@@ -2249,7 +2249,7 @@ streamMemParseTest(const char *filename, const char *result, const char *err,
 	return(-1);
     }
     reader = xmlReaderForMemory(base, size, filename, NULL, options);
-    ret = streamProcessTest(filename, result, err, reader, NULL);
+    ret = streamProcessTest(filename, result, err, reader, NULL, options);
     free((char *)base);
     xmlFreeTextReader(reader);
     return(ret);
@@ -3308,9 +3308,11 @@ rngStreamTest(const char *filename,
 	    fprintf(stderr, "Failed to build reder for %s\n", instance);
 	}
 	if (disable_err == 1)
-	    ret = streamProcessTest(instance, result, NULL, reader, filename);
+	    ret = streamProcessTest(instance, result, NULL, reader, filename,
+	                            options);
 	else
-	    ret = streamProcessTest(instance, result, err, reader, filename);
+	    ret = streamProcessTest(instance, result, err, reader, filename,
+	                            options);
 	xmlFreeTextReader(reader);
 	if (ret != 0) {
 	    fprintf(stderr, "instance %s failed\n", instance);
@@ -4203,6 +4205,14 @@ testDesc testDescriptions[] = {
     { "Validity checking regression tests" ,
       errParseTest, "./test/VC/*", "result/VC/", NULL, "",
       XML_PARSE_DTDVALID },
+#ifdef LIBXML_READER_ENABLED
+    { "Streaming validity checking regression tests" ,
+      streamParseTest, "./test/valid/*.xml", "result/valid/", NULL, ".err.rdr",
+      XML_PARSE_DTDVALID },
+    { "Streaming validity error checking regression tests" ,
+      streamParseTest, "./test/VC/*", "result/VC/", NULL, ".rdr",
+      XML_PARSE_DTDVALID },
+#endif
     { "General documents valid regression tests" ,
       errParseTest, "./test/valid/*", "result/valid/", "", ".err",
       XML_PARSE_DTDVALID },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]