version 1.1.1.1, 2012/02/21 23:37:58
|
version 1.1.1.3, 2014/06/15 19:53:30
|
Line 11
|
Line 11
|
* daniel@veillard.com |
* daniel@veillard.com |
*/ |
*/ |
|
|
#ifdef HAVE_CONFIG_H |
|
#include "libxml.h" |
#include "libxml.h" |
#else |
|
#include <stdio.h> |
#include <stdio.h> |
#endif |
|
|
|
#if !defined(_WIN32) || defined(__CYGWIN__) |
#if !defined(_WIN32) || defined(__CYGWIN__) |
#include <unistd.h> |
#include <unistd.h> |
Line 194 static void globfree(glob_t *pglob) {
|
Line 191 static void globfree(glob_t *pglob) {
|
free(pglob->gl_pathv[i]); |
free(pglob->gl_pathv[i]); |
} |
} |
} |
} |
#define vsnprintf _vsnprintf | |
#define snprintf _snprintf | |
#else |
#else |
#include <glob.h> |
#include <glob.h> |
#endif |
#endif |
Line 2097 static void processNode(FILE *out, xmlTextReaderPtr re
|
Line 2093 static void processNode(FILE *out, xmlTextReaderPtr re
|
} |
} |
static int |
static int |
streamProcessTest(const char *filename, const char *result, const char *err, |
streamProcessTest(const char *filename, const char *result, const char *err, |
xmlTextReaderPtr reader, const char *rng) { | xmlTextReaderPtr reader, const char *rng, int options) { |
int ret; |
int ret; |
char *temp = NULL; |
char *temp = NULL; |
FILE *t = NULL; |
FILE *t = NULL; |
Line 2193 streamParseTest(const char *filename, const char *resu
|
Line 2189 streamParseTest(const char *filename, const char *resu
|
int ret; |
int ret; |
|
|
reader = xmlReaderForFile(filename, NULL, options); |
reader = xmlReaderForFile(filename, NULL, options); |
ret = streamProcessTest(filename, result, err, reader, NULL); | ret = streamProcessTest(filename, result, err, reader, NULL, options); |
xmlFreeTextReader(reader); |
xmlFreeTextReader(reader); |
return(ret); |
return(ret); |
} |
} |
Line 2221 walkerParseTest(const char *filename, const char *resu
|
Line 2217 walkerParseTest(const char *filename, const char *resu
|
return(-1); |
return(-1); |
} |
} |
reader = xmlReaderWalker(doc); |
reader = xmlReaderWalker(doc); |
ret = streamProcessTest(filename, result, err, reader, NULL); | ret = streamProcessTest(filename, result, err, reader, NULL, options); |
xmlFreeTextReader(reader); |
xmlFreeTextReader(reader); |
xmlFreeDoc(doc); |
xmlFreeDoc(doc); |
return(ret); |
return(ret); |
Line 2253 streamMemParseTest(const char *filename, const char *r
|
Line 2249 streamMemParseTest(const char *filename, const char *r
|
return(-1); |
return(-1); |
} |
} |
reader = xmlReaderForMemory(base, size, filename, NULL, options); |
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); |
free((char *)base); |
xmlFreeTextReader(reader); |
xmlFreeTextReader(reader); |
return(ret); |
return(ret); |
Line 2728 static const char *urip_testURLs[] = {
|
Line 2724 static const char *urip_testURLs[] = {
|
"file:///path/to/a%20b.html", |
"file:///path/to/a%20b.html", |
"/path/to/a b.html", |
"/path/to/a b.html", |
"/path/to/a%20b.html", |
"/path/to/a%20b.html", |
"urip://example.com/résumé.html", | "urip://example.com/r" "\xe9" "sum" "\xe9" ".html", |
"urip://example.com/test?a=1&b=2%263&c=4#foo", |
"urip://example.com/test?a=1&b=2%263&c=4#foo", |
NULL |
NULL |
}; |
}; |
Line 3312 rngStreamTest(const char *filename,
|
Line 3308 rngStreamTest(const char *filename,
|
fprintf(stderr, "Failed to build reder for %s\n", instance); |
fprintf(stderr, "Failed to build reder for %s\n", instance); |
} |
} |
if (disable_err == 1) |
if (disable_err == 1) |
ret = streamProcessTest(instance, result, NULL, reader, filename); | ret = streamProcessTest(instance, result, NULL, reader, filename, |
| options); |
else |
else |
ret = streamProcessTest(instance, result, err, reader, filename); | ret = streamProcessTest(instance, result, err, reader, filename, |
| options); |
xmlFreeTextReader(reader); |
xmlFreeTextReader(reader); |
if (ret != 0) { |
if (ret != 0) { |
fprintf(stderr, "instance %s failed\n", instance); |
fprintf(stderr, "instance %s failed\n", instance); |
Line 3936 thread_specific_data(void *private_data)
|
Line 3934 thread_specific_data(void *private_data)
|
return ((void *) Okay); |
return ((void *) Okay); |
} |
} |
|
|
#if defined(linux) || defined(__sun) || defined(__APPLE_CC__) | #if defined WIN32 |
| |
#include <pthread.h> | |
| |
static pthread_t tid[MAX_ARGC]; | |
| |
static int | |
testThread(void) | |
{ | |
unsigned int i, repeat; | |
unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); | |
void *results[MAX_ARGC]; | |
int ret; | |
int res = 0; | |
| |
xmlInitParser(); | |
| |
for (repeat = 0; repeat < 500; repeat++) { | |
xmlLoadCatalog(catalog); | |
nb_tests++; | |
| |
for (i = 0; i < num_threads; i++) { | |
results[i] = NULL; | |
tid[i] = (pthread_t) - 1; | |
} | |
| |
for (i = 0; i < num_threads; i++) { | |
ret = pthread_create(&tid[i], 0, thread_specific_data, | |
(void *) testfiles[i]); | |
if (ret != 0) { | |
fprintf(stderr, "pthread_create failed\n"); | |
return (1); | |
} | |
} | |
for (i = 0; i < num_threads; i++) { | |
ret = pthread_join(tid[i], &results[i]); | |
if (ret != 0) { | |
fprintf(stderr, "pthread_join failed\n"); | |
return (1); | |
} | |
} | |
| |
xmlCatalogCleanup(); | |
for (i = 0; i < num_threads; i++) | |
if (results[i] != (void *) Okay) { | |
fprintf(stderr, "Thread %d handling %s failed\n", | |
i, testfiles[i]); | |
res = 1; | |
} | |
} | |
return (res); | |
} | |
| |
#elif defined WIN32 | |
#include <windows.h> |
#include <windows.h> |
#include <string.h> |
#include <string.h> |
|
|
Line 4115 testThread(void)
|
Line 4060 testThread(void)
|
return(1); |
return(1); |
return (0); |
return (0); |
} |
} |
|
|
|
#elif defined HAVE_PTHREAD_H |
|
#include <pthread.h> |
|
|
|
static pthread_t tid[MAX_ARGC]; |
|
|
|
static int |
|
testThread(void) |
|
{ |
|
unsigned int i, repeat; |
|
unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); |
|
void *results[MAX_ARGC]; |
|
int ret; |
|
int res = 0; |
|
|
|
xmlInitParser(); |
|
|
|
for (repeat = 0; repeat < 500; repeat++) { |
|
xmlLoadCatalog(catalog); |
|
nb_tests++; |
|
|
|
for (i = 0; i < num_threads; i++) { |
|
results[i] = NULL; |
|
tid[i] = (pthread_t) - 1; |
|
} |
|
|
|
for (i = 0; i < num_threads; i++) { |
|
ret = pthread_create(&tid[i], 0, thread_specific_data, |
|
(void *) testfiles[i]); |
|
if (ret != 0) { |
|
fprintf(stderr, "pthread_create failed\n"); |
|
return (1); |
|
} |
|
} |
|
for (i = 0; i < num_threads; i++) { |
|
ret = pthread_join(tid[i], &results[i]); |
|
if (ret != 0) { |
|
fprintf(stderr, "pthread_join failed\n"); |
|
return (1); |
|
} |
|
} |
|
|
|
xmlCatalogCleanup(); |
|
for (i = 0; i < num_threads; i++) |
|
if (results[i] != (void *) Okay) { |
|
fprintf(stderr, "Thread %d handling %s failed\n", |
|
i, testfiles[i]); |
|
res = 1; |
|
} |
|
} |
|
return (res); |
|
} |
|
|
#else |
#else |
static int |
static int |
testThread(void) |
testThread(void) |
Line 4207 testDesc testDescriptions[] = {
|
Line 4205 testDesc testDescriptions[] = {
|
{ "Validity checking regression tests" , |
{ "Validity checking regression tests" , |
errParseTest, "./test/VC/*", "result/VC/", NULL, "", |
errParseTest, "./test/VC/*", "result/VC/", NULL, "", |
XML_PARSE_DTDVALID }, |
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" , |
{ "General documents valid regression tests" , |
errParseTest, "./test/valid/*", "result/valid/", "", ".err", |
errParseTest, "./test/valid/*", "result/valid/", "", ".err", |
XML_PARSE_DTDVALID }, |
XML_PARSE_DTDVALID }, |