Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | set(SANITIZER_COMMON_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
| 2 | |
| 3 | set(SANITIZER_COMMON_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS}) |
| 4 | set(SANITIZER_COMMON_TESTSUITES) |
| 5 | |
| 6 | set(SUPPORTED_TOOLS) |
| 7 | if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD" AND NOT ANDROID) |
| 8 | list(APPEND SUPPORTED_TOOLS asan) |
| 9 | endif() |
| 10 | if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID) |
| 11 | list(APPEND SUPPORTED_TOOLS tsan) |
| 12 | list(APPEND SUPPORTED_TOOLS msan) |
Stephen Hines | 6a211c5 | 2014-07-21 00:49:56 -0700 | [diff] [blame^] | 13 | list(APPEND SUPPORTED_TOOLS lsan) |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 14 | endif() |
| 15 | |
| 16 | # Create a separate config for each tool we support. |
| 17 | foreach(tool ${SUPPORTED_TOOLS}) |
| 18 | string(TOUPPER ${tool} tool_toupper) |
| 19 | if(${tool_toupper}_SUPPORTED_ARCH) |
| 20 | set(SANITIZER_COMMON_LIT_TEST_MODE ${tool}) |
| 21 | configure_lit_site_cfg( |
| 22 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in |
| 23 | ${CMAKE_CURRENT_BINARY_DIR}/${tool}/lit.site.cfg) |
| 24 | list(APPEND SANITIZER_COMMON_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${tool}) |
| 25 | if(NOT COMPILER_RT_STANDALONE_BUILD) |
| 26 | list(APPEND SANITIZER_COMMON_TEST_DEPS ${tool}) |
| 27 | endif() |
| 28 | endif() |
| 29 | endforeach() |
| 30 | |
| 31 | # Unit tests. |
| 32 | if(COMPILER_RT_INCLUDE_TESTS) |
| 33 | configure_lit_site_cfg( |
| 34 | ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in |
| 35 | ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg) |
| 36 | list(APPEND SANITIZER_COMMON_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit) |
| 37 | list(APPEND SANITIZER_COMMON_TEST_DEPS SanitizerUnitTests) |
| 38 | endif() |
| 39 | |
| 40 | if(SANITIZER_COMMON_TESTSUITES) |
| 41 | add_lit_testsuite(check-sanitizer "Running sanitizer_common tests" |
| 42 | ${SANITIZER_COMMON_TESTSUITES} |
| 43 | DEPENDS ${SANITIZER_COMMON_TEST_DEPS}) |
| 44 | set_target_properties(check-sanitizer PROPERTIES FOLDER |
| 45 | "sanitizer_common tests") |
| 46 | endif() |