Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | set(DFSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
| 2 | |
Pirama Arumuga Nainar | c58a436 | 2016-09-19 23:00:23 -0700 | [diff] [blame] | 3 | set(DFSAN_TESTSUITES) |
| 4 | |
| 5 | set(DFSAN_TEST_ARCH ${DFSAN_SUPPORTED_ARCH}) |
| 6 | if(APPLE) |
| 7 | darwin_filter_host_archs(DFSAN_SUPPORTED_ARCH DFSAN_TEST_ARCH) |
| 8 | endif() |
| 9 | |
| 10 | foreach(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}) |
| 30 | endforeach() |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 31 | |
| 32 | set(DFSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS}) |
| 33 | if(NOT COMPILER_RT_STANDALONE_BUILD) |
| 34 | list(APPEND DFSAN_TEST_DEPS dfsan) |
| 35 | endif() |
| 36 | |
| 37 | add_lit_testsuite(check-dfsan "Running the DataFlowSanitizer tests" |
Pirama Arumuga Nainar | c58a436 | 2016-09-19 23:00:23 -0700 | [diff] [blame] | 38 | ${DFSAN_TESTSUITES} |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 39 | DEPENDS ${DFSAN_TEST_DEPS}) |
Pirama Arumuga Nainar | c58a436 | 2016-09-19 23:00:23 -0700 | [diff] [blame] | 40 | set_target_properties(check-dfsan PROPERTIES FOLDER "Compiler-RT Misc") |