From dc232d584619b2819a9c52d6ad5d8b5d56b392ba Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 20 May 2024 16:55:00 +0300 Subject: [PATCH] CMake: Add support for test_files.sh --- tests/tests.cmake | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/tests.cmake b/tests/tests.cmake index cb091eb2..384a4fb9 100644 --- a/tests/tests.cmake +++ b/tests/tests.cmake @@ -173,4 +173,24 @@ if(BUILD_TESTING) ) endforeach() endif() + + # test_files.sh decompresses files that use different filters and + # check types so run it only if support for all of them has been enabled. + if(UNIX AND HAVE_ALL_DECODERS AND HAVE_ALL_CHECK_TYPES AND LZIP_DECODER) + # test_files.sh doesn't make any temporary files but it + # must not be run at the top-level build directory because + # it checks if ../config.h exists. We don't want to read + # files outside the build directory! + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_files") + + add_test(NAME test_files.sh + COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_files.sh" ".." + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_files" + ) + + set_tests_properties(test_files.sh PROPERTIES + ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}/tests" + SKIP_RETURN_CODE 77 + ) + endif() endif()