Files
clang-p2996/libunwind/test/CMakeLists.txt
Alexander Richardson e599422954 [runtimes] Fix parsing of LIB{CXX,CXXABI,UNWIND}_TEST_PARAMS (#67691)
Since 78d649a417 the recommended way to
pass an executor is to use the _TEST_PARAMS variable, which means we now
pass more complicated value (including ones that may contain multiple
`=`) as part of this variable. However, the `REGEX REPLACE` being used
has greedy matches so everything up to the last = becomes part of the
variable name which results in invalid syntax in the generated lit
config file.

This was noticed due to builder failures for those using the
CrossWinToARMLinux.cmake cache file.

---------

Co-authored-by: Vladimir Vereschaka <vvereschaka@accesssoftek.com>
2023-10-04 18:11:37 -04:00

49 lines
1.6 KiB
CMake

include(AddLLVM) # for add_lit_testsuite
include(HandleLitArguments)
macro(pythonize_bool var)
if (${var})
set(${var} True)
else()
set(${var} False)
endif()
endmacro()
pythonize_bool(LIBUNWIND_ENABLE_CET)
pythonize_bool(LIBUNWIND_ENABLE_THREADS)
pythonize_bool(LIBUNWIND_USES_ARM_EHABI)
set(AUTO_GEN_COMMENT "## Autogenerated by libunwind configuration.\n# Do not edit!")
set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
if (LIBUNWIND_EXECUTOR)
message(DEPRECATION "LIBUNWIND_EXECUTOR is deprecated, please add executor=... to LIBUNWIND_TEST_PARAMS")
serialize_lit_string_param(SERIALIZED_LIT_PARAMS executor "${LIBUNWIND_EXECUTOR}")
endif()
serialize_lit_param(SERIALIZED_LIT_PARAMS enable_experimental False)
if (LLVM_USE_SANITIZER)
serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_sanitizer "${LLVM_USE_SANITIZER}")
endif()
if (CMAKE_CXX_COMPILER_TARGET)
serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${CMAKE_CXX_COMPILER_TARGET}")
else()
serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${LLVM_DEFAULT_TARGET_TRIPLE}")
endif()
serialize_lit_params_list(SERIALIZED_LIT_PARAMS LIBUNWIND_TEST_PARAMS)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/cmake-bridge.cfg.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake-bridge.cfg"
@ONLY)
configure_lit_site_cfg(
"${LIBUNWIND_TEST_CONFIG}"
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")
add_lit_testsuite(check-unwind "Running libunwind tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS unwind ${LIBUNWIND_TEST_DEPS})