[llvm-commits] [compiler-rt] r163797 - in /compiler-rt/trunk/lib/tsan: CMakeLists.txt rtl_tests/CMakeLists.txt unit_tests/CMakeLists.txt
Alexey Samsonov
samsonov at google.com
Thu Sep 13 07:04:57 PDT 2012
Author: samsonov
Date: Thu Sep 13 09:04:57 2012
New Revision: 163797
URL: http://llvm.org/viewvc/llvm-project?rev=163797&view=rev
Log:
[TSan] support building TSan unittests in CMake
Added:
compiler-rt/trunk/lib/tsan/rtl_tests/CMakeLists.txt
compiler-rt/trunk/lib/tsan/unit_tests/CMakeLists.txt
Modified:
compiler-rt/trunk/lib/tsan/CMakeLists.txt
Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=163797&r1=163796&r2=163797&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Thu Sep 13 09:04:57 2012
@@ -15,4 +15,33 @@
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.
Added: compiler-rt/trunk/lib/tsan/rtl_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl_tests/CMakeLists.txt?rev=163797&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl_tests/CMakeLists.txt (added)
+++ compiler-rt/trunk/lib/tsan/rtl_tests/CMakeLists.txt Thu Sep 13 09:04:57 2012
@@ -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})
Added: compiler-rt/trunk/lib/tsan/unit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/unit_tests/CMakeLists.txt?rev=163797&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/unit_tests/CMakeLists.txt (added)
+++ compiler-rt/trunk/lib/tsan/unit_tests/CMakeLists.txt Thu Sep 13 09:04:57 2012
@@ -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})
More information about the llvm-commits
mailing list