mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
Add command line option for temp directory in runtest
This commit is contained in:
parent
40e7ceaaaf
commit
e6ba4bd775
@ -569,8 +569,9 @@ if(LIBXML2_WITH_TESTS)
|
|||||||
foreach(TEST ${TESTS_THREADS})
|
foreach(TEST ${TESTS_THREADS})
|
||||||
add_executable(${TEST} ${TEST}.c)
|
add_executable(${TEST} ${TEST}.c)
|
||||||
target_link_libraries(${TEST} LibXml2 Threads::Threads)
|
target_link_libraries(${TEST} LibXml2 Threads::Threads)
|
||||||
add_test(NAME ${TEST} COMMAND ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
add_test(NAME testThreads COMMAND testThreads WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
23
runtest.c
23
runtest.c
@ -105,6 +105,7 @@ struct testDesc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int update_results = 0;
|
static int update_results = 0;
|
||||||
|
static char* temp_directory = NULL;
|
||||||
static int checkTestFile(const char *filename);
|
static int checkTestFile(const char *filename);
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
@ -1699,7 +1700,7 @@ saxParseTest(const char *filename, const char *result,
|
|||||||
char *temp;
|
char *temp;
|
||||||
|
|
||||||
nb_tests++;
|
nb_tests++;
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "out of memory\n");
|
fprintf(stderr, "out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -1818,7 +1819,7 @@ oldParseTest(const char *filename, const char *result,
|
|||||||
#endif
|
#endif
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
return(1);
|
return(1);
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "out of memory\n");
|
fprintf(stderr, "out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -2030,7 +2031,7 @@ noentParseTest(const char *filename, const char *result,
|
|||||||
doc = xmlReadFile(filename, NULL, options);
|
doc = xmlReadFile(filename, NULL, options);
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
return(1);
|
return(1);
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -2177,7 +2178,7 @@ streamProcessTest(const char *filename, const char *result, const char *err,
|
|||||||
|
|
||||||
nb_tests++;
|
nb_tests++;
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -2406,7 +2407,7 @@ xpathCommonTest(const char *filename, const char *result,
|
|||||||
int len, ret = 0;
|
int len, ret = 0;
|
||||||
char *temp;
|
char *temp;
|
||||||
|
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -2605,7 +2606,7 @@ xmlidDocTest(const char *filename,
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -2703,7 +2704,7 @@ uriCommonTest(const char *filename,
|
|||||||
char str[1024];
|
char str[1024];
|
||||||
int res = 0, i, ret;
|
int res = 0, i, ret;
|
||||||
|
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -3007,7 +3008,7 @@ schemasOneTest(const char *sch,
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = resultFilename(result, "", ".res");
|
temp = resultFilename(result, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -3178,7 +3179,7 @@ rngOneTest(const char *sch,
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = resultFilename(result, "", ".res");
|
temp = resultFilename(result, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -3528,7 +3529,7 @@ patternTest(const char *filename,
|
|||||||
fprintf(stderr, "Failed to open %s\n", filename);
|
fprintf(stderr, "Failed to open %s\n", filename);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
temp = resultFilename(filename, "", ".res");
|
temp = resultFilename(filename, temp_directory, ".res");
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
fatalError();
|
fatalError();
|
||||||
@ -4565,6 +4566,8 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
|||||||
update_results = 1;
|
update_results = 1;
|
||||||
else if (!strcmp(argv[a], "-quiet"))
|
else if (!strcmp(argv[a], "-quiet"))
|
||||||
tests_quiet = 1;
|
tests_quiet = 1;
|
||||||
|
else if (!strcmp(argv[a], "--out"))
|
||||||
|
temp_directory = argv[++a];
|
||||||
else {
|
else {
|
||||||
for (i = 0; testDescriptions[i].func != NULL; i++) {
|
for (i = 0; testDescriptions[i].func != NULL; i++) {
|
||||||
if (strstr(testDescriptions[i].desc, argv[a])) {
|
if (strstr(testDescriptions[i].desc, argv[a])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user