Files
clang-p2996/libunwind/test/CMakeLists.txt
Alexander Richardson 78d649a417 [libc++][lit] Allow overriding the executor for tests (#66545)
This is useful when trying to run multiple tests with different
arguments to the executor script. This is needed in my case since I
do not know the correct ssh connection arguments when building libc++.
The testing script I have spawns multiple QEMU instances that listen on
a given port on localhost and runs lit with the --num-shards/--run-shard
argument. In order to connect each shard to the right QEMU instances I
need to customize the arguments passed to ssh.py (--extra-ssh-args and
--extra-scp-args) but can't do this at configure time since the target
port is only known when running the tests but not when calling CMake.
This change allows me to pass `executor=ssh.py <args>` to lit once I
know
the right hostname/port for running the tests.

This also deprecates the `LIB{CXX,CXXABI,UNWIND}_EXECUTOR` CMake
variable
as the same can be achieved by adding `executor=...` to the
`LIB{CXX,CXXABI,UNWIND}_TEST_PARAMS` variable.
2023-09-26 15:19:31 +01:00

56 lines
1.7 KiB
CMake

include(AddLLVM) # for add_lit_testsuite
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")
macro(serialize_lit_param param value)
string(APPEND SERIALIZED_LIT_PARAMS "config.${param} = ${value}\n")
endmacro()
if (LIBUNWIND_EXECUTOR)
message(DEPRECATION "LIBUNWIND_EXECUTOR is deprecated, please add executor=... to LIBUNWIND_TEST_PARAMS")
serialize_lit_param(executor "\"${LIBUNWIND_EXECUTOR}\"")
endif()
serialize_lit_param(enable_experimental False)
if (LLVM_USE_SANITIZER)
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
endif()
if (CMAKE_CXX_COMPILER_TARGET)
serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"")
else()
serialize_lit_param(target_triple "\"${LLVM_DEFAULT_TARGET_TRIPLE}\"")
endif()
foreach(param IN LISTS LIBUNWIND_TEST_PARAMS)
string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
serialize_lit_param("${name}" "\"${value}\"")
endforeach()
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})