summaryrefslogtreecommitdiff
path: root/runtest.c
diff options
context:
space:
mode:
authorAron Xu <aron@debian.org>2012-09-18 01:15:22 +0800
committerAron Xu <aron@debian.org>2012-09-18 01:15:22 +0800
commitf660f9d2924c7549bc87e7f9b4ece7c9727b3682 (patch)
tree816b3ef0e89d1601803b5dc1b90b50ade0567043 /runtest.c
parentd7372d053bbd1d58216fbb04d1771ffa4cc3e624 (diff)
downloadlibxml2-f660f9d2924c7549bc87e7f9b4ece7c9727b3682.tar.gz
Imported Upstream version 2.9.0upstream/2.9.0
Diffstat (limited to 'runtest.c')
-rw-r--r--runtest.c117
1 files changed, 55 insertions, 62 deletions
diff --git a/runtest.c b/runtest.c
index dd74c88..c6517a3 100644
--- a/runtest.c
+++ b/runtest.c
@@ -11,11 +11,8 @@
* daniel@veillard.com
*/
-#ifdef HAVE_CONFIG_H
#include "libxml.h"
-#else
#include <stdio.h>
-#endif
#if !defined(_WIN32) || defined(__CYGWIN__)
#include <unistd.h>
@@ -195,10 +192,6 @@ static void globfree(glob_t *pglob) {
}
}
-#if !defined(__MINGW32__)
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
-#endif
#else
#include <glob.h>
#endif
@@ -2731,7 +2724,7 @@ static const char *urip_testURLs[] = {
"file:///path/to/a%20b.html",
"/path/to/a b.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",
NULL
};
@@ -3939,60 +3932,7 @@ thread_specific_data(void *private_data)
return ((void *) Okay);
}
-#if defined(linux) || defined(__sun) || defined(__APPLE_CC__)
-
-#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
+#if defined WIN32
#include <windows.h>
#include <string.h>
@@ -4118,6 +4058,59 @@ testThread(void)
return(1);
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
static int
testThread(void)