CMake: Port "make xml-runtest" over from GNU Autotools

This commit is contained in:
Sebastian Pipping 2019-09-01 22:51:18 +02:00
parent d78357da50
commit da8be0224c
2 changed files with 50 additions and 0 deletions

View file

@ -391,6 +391,55 @@ if(EXPAT_BUILD_FUZZERS)
endforeach()
endif(EXPAT_BUILD_FUZZERS)
#
# Custom target "run-xmltest"
#
if(EXPAT_BUILD_TOOLS AND NOT MSVC)
add_custom_target(
xmlts-zip-downloaded
COMMAND
sh -c 'test -f xmlts.zip || wget --output-document=xmlts.zip https://www.w3.org/XML/Test/xmlts20080827.zip'
BYPRODUCTS
tests/xmlts.zip
WORKING_DIRECTORY
tests/)
add_custom_target(
xmlts-zip-extracted
COMMAND
sh -c 'test -d xmlconf || unzip -q xmlts.zip'
BYPRODUCTS
tests/xmlconf
WORKING_DIRECTORY
tests/)
add_dependencies(xmlts-zip-extracted xmlts-zip-downloaded)
add_custom_target(
xmltest-sh-been-run
COMMAND
sh -c '${CMAKE_CURRENT_SOURCE_DIR}/tests/xmltest.sh "bash ${CMAKE_CURRENT_BINARY_DIR}/run.sh $<TARGET_FILE:xmlwf>" 2>&1 | tee tests/xmltest.log'
BYPRODUCTS
tests/xmltest.log)
add_dependencies(xmltest-sh-been-run xmlts-zip-extracted xmlwf)
add_custom_target(
xmltest-log-fixed
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/fix-xmltest-log.sh tests/xmltest.log
DEPENDS
tests/xmltest.log)
add_dependencies(xmltest-log-fixed xmltest-sh-been-run)
add_custom_target(
xmltest-log-verified
COMMAND
diff -u ${CMAKE_CURRENT_SOURCE_DIR}/tests/xmltest.log.expected tests/xmltest.log)
add_dependencies(xmltest-log-verified xmltest-log-fixed)
add_custom_target(run-xmltest)
add_dependencies(run-xmltest xmltest-log-verified)
endif()
#
# Documentation
#

View file

@ -58,6 +58,7 @@ Release x.x.x xxx xxx xx xxxx
#265 CMake: Fix linking with MinGW
#330 CMake: Add full support for MinGW; to enable, use
-DCMAKE_TOOLCHAIN_FILE=[expat]/cmake/mingw-toolchain.cmake
#330 CMake: Port "make run-xmltest" from GNU Autotools to CMake
#316 CMake: Windows: Make binary postfix match MSVC
Old: expat[d].lib
New: expat[w][d][MD|MT].lib