summaryrefslogtreecommitdiff
path: root/test/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'test/CMakeLists.txt')
-rw-r--r--test/CMakeLists.txt67
1 files changed, 26 insertions, 41 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7685fb3f426f1..9b4759dfb8d49 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -35,6 +35,16 @@ if(NOT ANDROID)
endif()
endif()
+function(compiler_rt_test_runtime runtime)
+ string(TOUPPER ${runtime} runtime_uppercase)
+ if(COMPILER_RT_HAS_${runtime_uppercase})
+ add_subdirectory(${runtime})
+ foreach(directory ${ARGN})
+ add_subdirectory(${directory})
+ endforeach()
+ endif()
+endfunction()
+
# Run sanitizer tests only if we're sure that clang would produce
# working binaries.
if(COMPILER_RT_CAN_EXECUTE_TESTS)
@@ -42,49 +52,24 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS)
add_subdirectory(builtins)
endif()
if(COMPILER_RT_BUILD_SANITIZERS)
- if(COMPILER_RT_HAS_ASAN)
- add_subdirectory(asan)
- endif()
- if(COMPILER_RT_HAS_DFSAN)
- add_subdirectory(dfsan)
- endif()
- if (COMPILER_RT_HAS_INTERCEPTION)
- add_subdirectory(interception)
- endif()
- if(COMPILER_RT_HAS_LSAN)
- add_subdirectory(lsan)
- endif()
- if(COMPILER_RT_HAS_MSAN)
- add_subdirectory(msan)
- endif()
- if(COMPILER_RT_HAS_PROFILE)
- add_subdirectory(profile)
- endif()
- if(COMPILER_RT_HAS_SANITIZER_COMMON)
- add_subdirectory(sanitizer_common)
- endif()
- if(COMPILER_RT_HAS_TSAN)
- add_subdirectory(tsan)
- endif()
- if(COMPILER_RT_HAS_UBSAN)
- add_subdirectory(ubsan)
- endif()
+ compiler_rt_test_runtime(interception)
+
+ compiler_rt_test_runtime(lsan)
# CFI tests require diagnostic mode, which is implemented in UBSan.
- if(COMPILER_RT_HAS_UBSAN)
- add_subdirectory(cfi)
- endif()
- if(COMPILER_RT_HAS_SAFESTACK)
- add_subdirectory(safestack)
- endif()
- if(COMPILER_RT_HAS_ESAN)
- add_subdirectory(esan)
- endif()
- if(COMPILER_RT_HAS_SCUDO)
- add_subdirectory(scudo)
- endif()
+ compiler_rt_test_runtime(ubsan cfi)
+ compiler_rt_test_runtime(sanitizer_common)
+
+ foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
+ # cfi testing is gated on ubsan
+ if(NOT ${sanitizer} STREQUAL cfi)
+ compiler_rt_test_runtime(${sanitizer})
+ endif()
+ endforeach()
+
+ compiler_rt_test_runtime(profile)
endif()
- if(COMPILER_RT_BUILD_XRAY AND COMPILER_RT_HAS_XRAY)
- add_subdirectory(xray)
+ if(COMPILER_RT_BUILD_XRAY)
+ compiler_rt_test_runtime(xray)
endif()
endif()