1set(DFSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2
3set(DFSAN_TESTSUITES)
4
5set(DFSAN_TEST_ARCH ${DFSAN_SUPPORTED_ARCH})
6if(APPLE)
7  darwin_filter_host_archs(DFSAN_SUPPORTED_ARCH DFSAN_TEST_ARCH)
8endif()
9
10foreach(arch ${DFSAN_TEST_ARCH})
11  set(DFSAN_TEST_TARGET_ARCH ${arch})
12  string(TOLOWER "-${arch}" DFSAN_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(DFSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
17    set(DFSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
18  else()
19    get_target_flags_for_arch(${arch} DFSAN_TEST_TARGET_CFLAGS)
20    string(REPLACE ";" " " DFSAN_TEST_TARGET_CFLAGS "${DFSAN_TEST_TARGET_CFLAGS}")
21  endif()
22
23  string(TOUPPER ${arch} ARCH_UPPER_CASE)
24  set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
25
26  configure_lit_site_cfg(
27    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
28    ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
29  list(APPEND DFSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
30endforeach()
31
32set(DFSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
33if(NOT COMPILER_RT_STANDALONE_BUILD)
34  list(APPEND DFSAN_TEST_DEPS dfsan)
35endif()
36
37add_lit_testsuite(check-dfsan "Running the DataFlowSanitizer tests"
38  ${DFSAN_TESTSUITES}
39  DEPENDS ${DFSAN_TEST_DEPS})
40set_target_properties(check-dfsan PROPERTIES FOLDER "Compiler-RT Misc")
41