summaryrefslogtreecommitdiff
path: root/lib/tsan/tests
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-02-20 12:03:56 +0000
committerAlexey Samsonov <samsonov@google.com>2014-02-20 12:03:56 +0000
commite20c23ce1585d3b49cbe3c127b88d3ef1bbc7c41 (patch)
treeb874e1c8588b43e7be292bbec31e4653903b3947 /lib/tsan/tests
parenteca631432294661e7fe02ba8fe765a1c21544bea (diff)
[CMake] break dependency between unit tests and runtimes in standalone build
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/tests')
-rw-r--r--lib/tsan/tests/CMakeLists.txt20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/tsan/tests/CMakeLists.txt b/lib/tsan/tests/CMakeLists.txt
index d42182416..1e095f142 100644
--- a/lib/tsan/tests/CMakeLists.txt
+++ b/lib/tsan/tests/CMakeLists.txt
@@ -11,14 +11,23 @@ set(TSAN_UNITTEST_CFLAGS
-I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl
-DGTEST_HAS_RTTI=0)
+set(TSAN_RTL_HEADERS)
+foreach (header ${TSAN_HEADERS})
+ list(APPEND TSAN_RTL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../${header})
+endforeach()
+
# tsan_compile(obj_list, source, arch, {headers})
macro(tsan_compile obj_list source arch)
get_filename_component(basename ${source} NAME)
set(output_obj "${basename}.${arch}.o")
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
+ set(COMPILE_DEPS ${TSAN_RTL_HEADERS} ${ARGN})
+ if(NOT COMPILER_RT_STANDALONE_BUILD)
+ list(APPEND COMPILE_DEPS gtest tsan)
+ endif()
clang_compile(${output_obj} ${source}
CFLAGS ${TSAN_UNITTEST_CFLAGS} ${TARGET_CFLAGS}
- DEPS gtest tsan ${ARGN})
+ DEPS ${COMPILE_DEPS})
list(APPEND ${obj_list} ${output_obj})
endmacro()
@@ -31,9 +40,16 @@ macro(add_tsan_unittest testname)
tsan_compile(TEST_OBJECTS ${SOURCE} x86_64 ${TEST_HEADERS})
endforeach()
get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
+ set(TEST_DEPS ${TEST_OBJECTS})
+ if(NOT COMPILER_RT_STANDALONE_BUILD)
+ list(APPEND TEST_DEPS tsan)
+ endif()
+ # FIXME: Looks like we should link TSan with just-built runtime,
+ # and not rely on -fsanitize=thread, as these tests are essentially
+ # unit tests.
add_compiler_rt_test(TsanUnitTests ${testname}
OBJECTS ${TEST_OBJECTS}
- DEPS tsan ${TEST_OBJECTS}
+ DEPS ${TEST_DEPS}
LINK_FLAGS ${TARGET_LINK_FLAGS}
-fsanitize=thread
-lstdc++ -lm)