1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-04 01:47:02 +03:00

Adding streaming validation to runtest checks

This commit is contained in:
Daniel Veillard 2012-10-25 15:39:39 +08:00
parent 1abd221be5
commit a7982ce272
51 changed files with 176 additions and 6 deletions

View File

@ -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"/>
^

View File

@ -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 "/>
^

View File

@ -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)*>
^

View File

@ -0,0 +1,3 @@
./test/VC/ElementValid:3: validity error : Validation failed: no DTD found !
<doc/>
^

View File

@ -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
^

View File

@ -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
^

View File

@ -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
^

View File

@ -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
^

View File

@ -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
^

View File

@ -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
^

View File

@ -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>
^

View File

@ -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>
^

0
result/VC/NS1.rdr Normal file
View File

3
result/VC/NS2.rdr Normal file
View File

@ -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/">
^

9
result/VC/NS3.rdr Normal file
View File

@ -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"/
^

6
result/VC/OneID.rdr Normal file
View File

@ -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>
^

6
result/VC/OneID2.rdr Normal file
View File

@ -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>
^

6
result/VC/OneID3.rdr Normal file
View File

@ -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>
^

4
result/VC/PENesting.rdr Normal file
View File

@ -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

4
result/VC/PENesting2.rdr Normal file
View File

@ -0,0 +1,4 @@
./test/VC/PENesting2:1: parser error : StartTag: invalid element name
<!ENTITY % p1 "(A|B">
^
./test/VC/PENesting2 : failed to parse

View File

@ -0,0 +1,3 @@
test/VC/dtds/a.dtd:1: validity error : Redefinition of element a
<!ELEMENT a (#PCDATA | b | c)*>
^

View File

@ -0,0 +1,3 @@
./test/VC/UniqueElementTypeDeclaration2:6: validity error : Redefinition of element a
<!ELEMENT a (#PCDATA | b | c)*>
^

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -0,0 +1,3 @@
./test/valid/rss.xml:177: element rss: validity error : Element rss does not carry attribute version
</rss>
^

View File

View File

View File

@ -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;">
^

View File

View File

@ -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;">
^

View File

View File

@ -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">
^

View File

View File

@ -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

View File

@ -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

View File

View File

View File

View File

@ -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"

View File

@ -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 },