[NFC][Py Reformat] Reformat python files in llvm
[llvm-project.git] / libunwind / test / CMakeLists.txt
blobe6bd52690442578bfeb5641e080a6431f111f535
1 include(AddLLVM) # for add_lit_testsuite
2 macro(pythonize_bool var)
3   if (${var})
4     set(${var} True)
5   else()
6     set(${var} False)
7   endif()
8 endmacro()
10 pythonize_bool(LIBUNWIND_ENABLE_CET)
11 pythonize_bool(LIBUNWIND_ENABLE_THREADS)
12 pythonize_bool(LIBUNWIND_USES_ARM_EHABI)
13 set(LIBUNWIND_EXECUTOR "\\\"${Python3_EXECUTABLE}\\\" ${LIBUNWIND_LIBCXX_PATH}/utils/run.py" CACHE STRING
14     "Executor to use when running tests.")
16 set(AUTO_GEN_COMMENT "## Autogenerated by libunwind configuration.\n# Do not edit!")
17 set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
19 macro(serialize_lit_param param value)
20   string(APPEND SERIALIZED_LIT_PARAMS "config.${param} = ${value}\n")
21 endmacro()
23 serialize_lit_param(enable_experimental False)
25 if (LLVM_USE_SANITIZER)
26   serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
27 endif()
29 if (CMAKE_CXX_COMPILER_TARGET)
30   serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"")
31 else()
32   serialize_lit_param(target_triple "\"${LLVM_DEFAULT_TARGET_TRIPLE}\"")
33 endif()
35 foreach(param IN LISTS LIBUNWIND_TEST_PARAMS)
36   string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
37   string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
38   serialize_lit_param("${name}" "\"${value}\"")
39 endforeach()
41 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/cmake-bridge.cfg.in"
42                "${CMAKE_CURRENT_BINARY_DIR}/cmake-bridge.cfg"
43                @ONLY)
45 configure_lit_site_cfg(
46   "${LIBUNWIND_TEST_CONFIG}"
47   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
48   MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")
50 add_lit_testsuite(check-unwind "Running libunwind tests"
51   ${CMAKE_CURRENT_BINARY_DIR}
52   DEPENDS unwind ${LIBUNWIND_TEST_DEPS})