diff options
| -rw-r--r-- | compiler-rt/lib/tsan/CMakeLists.txt | 29 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl_tests/CMakeLists.txt | 15 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/unit_tests/CMakeLists.txt | 15 |
3 files changed, 59 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt index fc20cd88b0d..39f3ed34613 100644 --- a/compiler-rt/lib/tsan/CMakeLists.txt +++ b/compiler-rt/lib/tsan/CMakeLists.txt @@ -15,4 +15,33 @@ else() endif() add_subdirectory(rtl) + +if(LLVM_INCLUDE_TESTS) + add_custom_target(TsanUnitTests) + set_target_properties(TsanUnitTests PROPERTIES + FOLDER "TSan unittests") + + function(add_tsan_unittest testname) + # Build unit tests only on 64-bit Linux. + if(UNIX AND NOT APPLE + AND CAN_TARGET_X86_64 + AND CMAKE_SIZEOF_VOID_P EQUAL 8 + AND NOT LLVM_BUILD_32_BITS) + add_unittest(TsanUnitTests ${testname} ${ARGN}) + # Link with TSan runtime. + target_link_libraries(${testname} clang_rt.tsan-x86_64) + # Build tests with PIE and debug info. + set_property(TARGET ${testname} APPEND_STRING + PROPERTY COMPILE_FLAGS " -fPIE -g") + set_property(TARGET ${testname} APPEND_STRING + PROPERTY LINK_FLAGS " -pie") + endif() + endfunction() + + include_directories(rtl) + # There are two groups of unit tests: rtl_tests and unit_tests. + add_subdirectory(rtl_tests) + add_subdirectory(unit_tests) +endif() + # FIXME: Support TSan runtime tests, unit tests and output tests. diff --git a/compiler-rt/lib/tsan/rtl_tests/CMakeLists.txt b/compiler-rt/lib/tsan/rtl_tests/CMakeLists.txt new file mode 100644 index 00000000000..b585660e8b4 --- /dev/null +++ b/compiler-rt/lib/tsan/rtl_tests/CMakeLists.txt @@ -0,0 +1,15 @@ +set(TSAN_RTL_TESTS + tsan_bench.cc + tsan_mop.cc + tsan_mutex.cc + tsan_posix.cc + tsan_string.cc + tsan_test.cc + tsan_thread.cc + ) + +if(UNIX AND NOT APPLE) + list(APPEND TSAN_RTL_TESTS tsan_test_util_linux.cc) +endif() + +add_tsan_unittest(TsanRtlTest ${TSAN_RTL_TESTS}) diff --git a/compiler-rt/lib/tsan/unit_tests/CMakeLists.txt b/compiler-rt/lib/tsan/unit_tests/CMakeLists.txt new file mode 100644 index 00000000000..5608e2461ff --- /dev/null +++ b/compiler-rt/lib/tsan/unit_tests/CMakeLists.txt @@ -0,0 +1,15 @@ +set(TSAN_UNIT_TESTS + tsan_clock_test.cc + tsan_flags_test.cc + tsan_mman_test.cc + tsan_mutex_test.cc + tsan_platform_test.cc + tsan_printf_test.cc + tsan_shadow_test.cc + tsan_stack_test.cc + tsan_suppressions_test.cc + tsan_sync_test.cc + tsan_vector_test.cc + ) + +add_tsan_unittest(TsanUnitTest ${TSAN_UNIT_TESTS}) |

