• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(LSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2
3set(LSAN_TESTSUITES)
4
5set(LSAN_TEST_ARCH ${LSAN_SUPPORTED_ARCH})
6if(APPLE)
7  darwin_filter_host_archs(LSAN_SUPPORTED_ARCH LSAN_TEST_ARCH)
8endif()
9
10foreach(arch ${LSAN_TEST_ARCH})
11  set(LSAN_TEST_TARGET_ARCH ${arch})
12  string(TOLOWER "-${arch}" LSAN_TEST_CONFIG_SUFFIX)
13  if(ANDROID OR ${arch} MATCHES "arm|aarch64")
14    # This is only true if we are cross-compiling.
15    # Build all tests with host compiler and use host tools.
16    set(LSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
17    set(LSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
18  else()
19    get_target_flags_for_arch(${arch} LSAN_TEST_TARGET_CFLAGS)
20    string(REPLACE ";" " " LSAN_TEST_TARGET_CFLAGS "${LSAN_TEST_TARGET_CFLAGS}")
21  endif()
22
23  string(TOUPPER ${arch} ARCH_UPPER_CASE)
24  set(LSAN_LIT_TEST_MODE "Standalone")
25  set(CONFIG_NAME ${ARCH_UPPER_CASE}LsanConfig)
26
27  configure_lit_site_cfg(
28    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
29    ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
30  list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
31
32  set(CONFIG_NAME ${ARCH_UPPER_CASE}AsanConfig)
33  set(LSAN_LIT_TEST_MODE "AddressSanitizer")
34
35  configure_lit_site_cfg(
36    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
37    ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
38  list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
39endforeach()
40
41set(LSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
42if(NOT COMPILER_RT_STANDALONE_BUILD)
43  list(APPEND LSAN_TEST_DEPS lsan asan)
44endif()
45add_lit_testsuite(check-lsan "Running the LeakSanitizer tests"
46  ${LSAN_TESTSUITES}
47  DEPENDS ${LSAN_TEST_DEPS})
48set_target_properties(check-lsan PROPERTIES FOLDER "Compiler-RT Misc")
49