mirror of https://git.tukaani.org/xz.git
CMake: Prepare to support the test_*.sh tests
This is a bit hacky since the scripts grep config.h to know which features were built but the CMake build doesn't create config.h. So instead those test scripts will be run only when all relevant features have been enabled.
This commit is contained in:
parent
6167607a6e
commit
006040b29c
|
@ -16,6 +16,10 @@
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
|
#################
|
||||||
|
# liblzma tests #
|
||||||
|
#################
|
||||||
|
|
||||||
set(LIBLZMA_TESTS
|
set(LIBLZMA_TESTS
|
||||||
test_bcj_exact_size
|
test_bcj_exact_size
|
||||||
test_block_header
|
test_block_header
|
||||||
|
@ -72,6 +76,51 @@ if(BUILD_TESTING)
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Command line tool tests #
|
||||||
|
###########################
|
||||||
|
|
||||||
|
# Since the CMake-based build doesn't use config.h, the test scripts
|
||||||
|
# cannot grep the contents of config.h to know which features have
|
||||||
|
# been disabled. When config.h is missing, they assume that all
|
||||||
|
# features are enabled. Thus, check if certain groups of features have
|
||||||
|
# been disabled and then possibly skip some of the tests entirely instead
|
||||||
|
# of letting them fail.
|
||||||
|
set(SUPPORTED_FILTERS_SORTED "${SUPPORTED_FILTERS}")
|
||||||
|
list(SORT SUPPORTED_FILTERS_SORTED)
|
||||||
|
|
||||||
|
set(ENCODERS_SORTED "${ENCODERS}")
|
||||||
|
list(SORT ENCODERS_SORTED)
|
||||||
|
|
||||||
|
if("${ENCODERS_SORTED}" STREQUAL "${SUPPORTED_FILTERS_SORTED}")
|
||||||
|
set(HAVE_ALL_ENCODERS ON)
|
||||||
|
else()
|
||||||
|
set(HAVE_ALL_ENCODERS OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(DECODERS_SORTED "${DECODERS}")
|
||||||
|
list(SORT DECODERS_SORTED)
|
||||||
|
|
||||||
|
if("${DECODERS_SORTED}" STREQUAL "${SUPPORTED_FILTERS_SORTED}")
|
||||||
|
set(HAVE_ALL_DECODERS ON)
|
||||||
|
else()
|
||||||
|
set(HAVE_ALL_DECODERS OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ADDITIONAL_SUPPORTED_CHECKS_SORTED "${ADDITIONAL_SUPPORTED_CHECKS}")
|
||||||
|
list(SORT ADDITIONAL_SUPPORTED_CHECKS_SORTED)
|
||||||
|
|
||||||
|
set(ADDITIONAL_CHECK_TYPES_SORTED "${ADDITIONAL_CHECK_TYPES}")
|
||||||
|
list(SORT ADDITIONAL_CHECK_TYPES_SORTED)
|
||||||
|
|
||||||
|
if("${ADDITIONAL_SUPPORTED_CHECKS_SORTED}" STREQUAL
|
||||||
|
"${ADDITIONAL_CHECK_TYPES_SORTED}")
|
||||||
|
set(HAVE_ALL_CHECK_TYPES ON)
|
||||||
|
else()
|
||||||
|
set(HAVE_ALL_CHECK_TYPES OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(UNIX AND HAVE_DECODERS)
|
if(UNIX AND HAVE_DECODERS)
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_scripts")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_scripts")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue