mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-24 06:50:08 +03:00
tests: Look for xmlconf in source directory
Add -d option to runxmlconf for automake. Fix extraction of xmlconf.tar.gz on Windows. Make runxmlconf work with Meson CI.
This commit is contained in:
parent
aedc1f3d14
commit
22ada0a0bf
@ -5,7 +5,7 @@
|
||||
before_script:
|
||||
- rm -rf libxml2-build
|
||||
- mkdir libxml2-build
|
||||
- ln -s /tests/xmlconf libxml2-build
|
||||
- ln -s /tests/xmlconf .
|
||||
script:
|
||||
- sh .gitlab-ci/test.sh
|
||||
|
||||
@ -84,7 +84,7 @@ clang:msan:
|
||||
cache:
|
||||
key: "$MSYSTEM"
|
||||
paths:
|
||||
- libxml2-build/xmlconf/
|
||||
- xmlconf/
|
||||
|
||||
mingw:w64-x86_64:shared:
|
||||
extends: .mingw
|
||||
@ -112,7 +112,7 @@ mingw:w64-i686:shared:
|
||||
before_script:
|
||||
- rm -rf libxml2-build
|
||||
- mkdir libxml2-build
|
||||
- ln -s /tests/xmlconf libxml2-build
|
||||
- ln -s /tests/xmlconf .
|
||||
script:
|
||||
- sh .gitlab-ci/test_cmake.sh
|
||||
artifacts:
|
||||
@ -172,7 +172,7 @@ cmake:linux:clang:static:
|
||||
cache:
|
||||
key: "$MSYSTEM"
|
||||
paths:
|
||||
- libxml2-build/xmlconf/
|
||||
- xmlconf/
|
||||
artifacts:
|
||||
paths:
|
||||
- libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:SUFFIX.tar.gz
|
||||
@ -228,7 +228,7 @@ cmake:mingw:w64-x86_64:static:
|
||||
key: "msvc"
|
||||
paths:
|
||||
- cmake-$Env:CMAKE_VERSION-win64-x64/
|
||||
- libxml2-build/xmlconf/
|
||||
- xmlconf/
|
||||
- 7za.exe
|
||||
artifacts:
|
||||
paths:
|
||||
@ -283,6 +283,8 @@ cmake:msvc:v141:x86:static:
|
||||
|
||||
meson:
|
||||
image: registry.gitlab.gnome.org/gnome/libxml2
|
||||
before_script:
|
||||
- ln -s /tests/xmlconf .
|
||||
script:
|
||||
- sh .gitlab-ci/test_meson.sh
|
||||
|
||||
|
@ -15,11 +15,12 @@ if (-not (Test-Path 7za.exe)) {
|
||||
cmake -E tar xf 7z1900-extra.7z 7za.exe
|
||||
}
|
||||
|
||||
if (-not (Test-Path libxml2-build/xmlconf)) {
|
||||
if (-not (Test-Path xmlconf)) {
|
||||
Invoke-WebRequest `
|
||||
-Uri https://www.w3.org/XML/Test/xmlts20080827.tar.gz `
|
||||
-OutFile xmlts20080827.tar.gz ;
|
||||
.\7za.exe x xmlts20080827.tar.gz -olibxml2-build
|
||||
.\7za.exe x xmlts20080827.tar.gz
|
||||
.\7za.exe x xmlts20080827.tar
|
||||
}
|
||||
|
||||
cmake `
|
||||
|
@ -10,8 +10,9 @@ for module in libiconv python xz zlib "$@"; do
|
||||
pacman --noconfirm -S --needed ${prefix}$module
|
||||
done
|
||||
|
||||
if [ ! -e libxml2-build/xmlconf ]; then
|
||||
mkdir -p libxml2-build
|
||||
mkdir -p libxml2-build
|
||||
|
||||
if [ ! -e xmlconf ]; then
|
||||
wget https://www.w3.org/XML/Test/xmlts20080827.tar -O - |
|
||||
tar -x -C libxml2-build
|
||||
tar -x
|
||||
fi
|
||||
|
@ -76,8 +76,6 @@ cmake_dependent_option(
|
||||
LIBXML2_WITH_XPTR "Add the XPointer support" ON
|
||||
"LIBXML2_WITH_XPATH" OFF)
|
||||
|
||||
set(LIBXML2_XMLCONF_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Working directory for XML Conformance Test Suite")
|
||||
|
||||
if(LIBXML2_WITH_PYTHON)
|
||||
find_package(Python COMPONENTS Interpreter Development REQUIRED)
|
||||
#set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory")
|
||||
@ -506,8 +504,8 @@ if(LIBXML2_WITH_TESTS)
|
||||
endif()
|
||||
add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_test(NAME runsuite COMMAND runsuite WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
if(EXISTS ${LIBXML2_XMLCONF_WORKING_DIR}/xmlconf/xmlconf.xml)
|
||||
add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${LIBXML2_XMLCONF_WORKING_DIR})
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/xmlconf/xmlconf.xml)
|
||||
add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
add_test(NAME testapi COMMAND testapi)
|
||||
|
@ -176,7 +176,7 @@ check-local:
|
||||
$(CHECKER) ./testdict$(EXEEXT)
|
||||
$(CHECKER) ./testparser$(EXEEXT)
|
||||
$(CHECKER) ./testModule$(EXEEXT)
|
||||
$(CHECKER) ./runxmlconf$(EXEEXT)
|
||||
$(CHECKER) ./runxmlconf$(EXEEXT) -d $(srcdir)/xmlconf
|
||||
$(CHECKER) ./runsuite$(EXEEXT)
|
||||
if WITH_DEBUG_SOURCES
|
||||
test/scripts/test.sh ./xmllint$(EXEEXT)
|
||||
|
26
runxmlconf.c
26
runxmlconf.c
@ -504,12 +504,14 @@ xmlconfInfo(void) {
|
||||
}
|
||||
|
||||
static int
|
||||
xmlconfTest(void) {
|
||||
const char *confxml = "xmlconf/xmlconf.xml";
|
||||
xmlconfTest(const char *dir) {
|
||||
char confxml[500];
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr cur;
|
||||
int ret = 0;
|
||||
|
||||
snprintf(confxml, sizeof(confxml), "%s/xmlconf.xml", dir);
|
||||
|
||||
if (!checkTestFile(confxml)) {
|
||||
fprintf(stderr, "%s is missing \n", confxml);
|
||||
xmlconfInfo();
|
||||
@ -541,9 +543,11 @@ xmlconfTest(void) {
|
||||
************************************************************************/
|
||||
|
||||
int
|
||||
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
main(int argc, char **argv) {
|
||||
int ret = 0;
|
||||
int old_errors, old_tests, old_leaks;
|
||||
const char *dir = "xmlconf";
|
||||
int i;
|
||||
|
||||
logfile = fopen(LOGFILE, "wb");
|
||||
if (logfile == NULL) {
|
||||
@ -553,14 +557,22 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
initializeLibxml2();
|
||||
|
||||
if ((argc >= 2) && (!strcmp(argv[1], "-v")))
|
||||
verbose = 1;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-v") == 0) {
|
||||
verbose = 1;
|
||||
} else if (strcmp(argv[i], "-d") == 0 && i + 1 < argc) {
|
||||
i += 1;
|
||||
dir = argv[i];
|
||||
} else {
|
||||
fprintf(stderr, "invalid argument: %s\n", argv[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
old_errors = nb_errors;
|
||||
old_tests = nb_tests;
|
||||
old_leaks = nb_leaks;
|
||||
xmlconfTest();
|
||||
xmlconfTest(dir);
|
||||
if ((nb_errors == old_errors) && (nb_leaks == old_leaks))
|
||||
printf("Ran %d tests, no errors\n", nb_tests - old_tests);
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user