blob: c2baf930d7685511a13920f9fc4e24ea3406764e [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001set(DFSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -07003set(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()
Stephen Hines2d1fdb22014-05-28 23:58:16 -070031
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"
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -070038 ${DFSAN_TESTSUITES}
Stephen Hines2d1fdb22014-05-28 23:58:16 -070039 DEPENDS ${DFSAN_TEST_DEPS})
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -070040set_target_properties(check-dfsan PROPERTIES FOLDER "Compiler-RT Misc")