• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(GWP_ASAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2set(GWP_ASAN_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
3
4set(GWP_ASAN_TESTSUITES)
5
6set(GWP_ASAN_UNITTEST_DEPS)
7set(GWP_ASAN_TEST_DEPS
8  ${SANITIZER_COMMON_LIT_TEST_DEPS}
9  gwp_asan
10  scudo)
11
12# Longstanding issues in the Android test runner means that compiler-rt unit
13# tests don't work on Android due to libc++ link-time issues. Looks like the
14# exported libc++ from the Android NDK is x86-64, even though it's part of the
15# ARM[64] toolchain... See similar measures for ASan and sanitizer-common that
16# disable unit tests for Android.
17if (COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_HAS_GWP_ASAN AND NOT ANDROID)
18  list(APPEND GWP_ASAN_TEST_DEPS GwpAsanUnitTests)
19  configure_lit_site_cfg(
20    ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.py.in
21    ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg.py)
22  list(APPEND GWP_ASAN_TEST_DEPS ${GWP_ASAN_TEST_DEPS})
23  list(APPEND GWP_ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/unit)
24endif()
25
26configure_lit_site_cfg(
27  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
28  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
29  )
30
31foreach(arch ${GWP_ASAN_SUPPORTED_ARCH})
32  set(GWP_ASAN_TEST_TARGET_ARCH ${arch})
33  string(TOLOWER "-${arch}" GWP_ASAN_TEST_CONFIG_SUFFIX)
34  get_test_cc_for_arch(${arch} GWP_ASAN_TEST_TARGET_CC GWP_ASAN_TEST_TARGET_CFLAGS)
35  string(TOUPPER ${arch} ARCH_UPPER_CASE)
36  set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
37
38  configure_lit_site_cfg(
39    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
40    ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
41  list(APPEND GWP_ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
42endforeach()
43
44add_lit_testsuite(check-gwp_asan "Running the GWP-ASan tests"
45  ${GWP_ASAN_TESTSUITES}
46  DEPENDS ${GWP_ASAN_TEST_DEPS})
47set_target_properties(check-gwp_asan PROPERTIES FOLDER "Compiler-RT Misc")
48