Mir

Merge lp:~albaguirre/mir/fix-1522581 into lp:mir

Proposed by Alberto Aguirre
Status: Merged
Approved by: Alexandros Frantzis
Approved revision: no longer in the source branch.
Merged at revision: 3181
Proposed branch: lp:~albaguirre/mir/fix-1522581
Merge into: lp:mir
Diff against target: 75 lines (+15/-10)
4 files modified
CMakeLists.txt (+3/-0)
cmake/FindGtestGmock.cmake (+7/-0)
cmake/MirCommon.cmake (+4/-6)
tools/tsan-suppressions (+1/-4)
To merge this branch: bzr merge lp:~albaguirre/mir/fix-1522581
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve
Alan Griffiths Approve
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+279533@code.launchpad.net

Commit message

Fix TSan build when using GCC

Description of the change

Fix TSan build when using GCC

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Builds and works properly on xenial.

Note that TSAN catches some data races in our tests, so there is some work to be done before we reenable a CI job for this.

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Actually, (some of) these comments seem to be out-of-date?

# TSan does not support multi-threaded fork
# TSan may open fds so "surface_creation_does_not_leak_fds" will not work as written
# TSan deadlocks when running StreamTransportTest/0.SendsFullMessagesWhenInterrupted - disable it until understood

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sounds good.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-12-02 14:55:35 +0000
+++ CMakeLists.txt 2015-12-04 15:08:42 +0000
@@ -103,6 +103,9 @@
103 # -fsanitize=thread is used, but doesn't.103 # -fsanitize=thread is used, but doesn't.
104 #104 #
105 # Linking everything with tsan is harmless and simple, so do that.105 # Linking everything with tsan is harmless and simple, so do that.
106 if (CMAKE_VERSION VERSION_GREATER 3.2.1)
107 cmake_policy(SET CMP0022 OLD)
108 endif()
106 link_libraries(tsan)109 link_libraries(tsan)
107 endif()110 endif()
108 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=thread")111 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=thread")
109112
=== modified file 'cmake/FindGtestGmock.cmake'
--- cmake/FindGtestGmock.cmake 2015-09-09 18:37:28 +0000
+++ cmake/FindGtestGmock.cmake 2015-12-04 15:08:42 +0000
@@ -23,11 +23,18 @@
23set(GTEST_CXX_FLAGS "-fPIC")23set(GTEST_CXX_FLAGS "-fPIC")
24if (cmake_build_type_lower MATCHES "threadsanitizer")24if (cmake_build_type_lower MATCHES "threadsanitizer")
25 set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=thread")25 set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=thread")
26elseif (cmake_build_type_lower MATCHES "ubsanitizer")
27 set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=undefined")
26endif()28endif()
2729
28set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}")30set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}")
29list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})31list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
30list(APPEND GTEST_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})32list(APPEND GTEST_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
33if (cmake_build_type_lower MATCHES "threadsanitizer")
34 #Skip compiler check, since if GCC is the compiler, we need to link against -ltsan
35 #explicitly; specifying additional linker flags doesn't seem possible for external projects
36 list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER_WORKS=1)
37endif()
31if (${CMAKE_CROSSCOMPILING})38if (${CMAKE_CROSSCOMPILING})
32 if(DEFINED MIR_NDK_PATH)39 if(DEFINED MIR_NDK_PATH)
33 list(APPEND GTEST_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake)40 list(APPEND GTEST_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake)
3441
=== modified file 'cmake/MirCommon.cmake'
--- cmake/MirCommon.cmake 2015-10-07 02:34:05 +0000
+++ cmake/MirCommon.cmake 2015-12-04 15:08:42 +0000
@@ -67,16 +67,14 @@
67 endif()67 endif()
6868
69 if(cmake_build_type_lower MATCHES "threadsanitizer")69 if(cmake_build_type_lower MATCHES "threadsanitizer")
70 find_program(LLVM_SYMBOLIZER llvm-symbolizer-3.6)70 if (NOT CMAKE_COMPILER_IS_GNUCXX)
71 if (LLVM_SYMBOLIZER)71 find_program(LLVM_SYMBOLIZER llvm-symbolizer-3.6)
72 if (LLVM_SYMBOLIZER)
72 set(TSAN_EXTRA_OPTIONS "external_symbolizer_path=${LLVM_SYMBOLIZER}")73 set(TSAN_EXTRA_OPTIONS "external_symbolizer_path=${LLVM_SYMBOLIZER}")
74 endif()
73 endif()75 endif()
74 # Space after ${TSAN_EXTRA_OPTIONS} works around bug in TSAN env. variable parsing 76 # Space after ${TSAN_EXTRA_OPTIONS} works around bug in TSAN env. variable parsing
75 list(APPEND test_env "TSAN_OPTIONS=\"suppressions=${CMAKE_SOURCE_DIR}/tools/tsan-suppressions second_deadlock_stack=1 halt_on_error=1 history_size=7 ${TSAN_EXTRA_OPTIONS} \"")77 list(APPEND test_env "TSAN_OPTIONS=\"suppressions=${CMAKE_SOURCE_DIR}/tools/tsan-suppressions second_deadlock_stack=1 halt_on_error=1 history_size=7 ${TSAN_EXTRA_OPTIONS} \"")
76 # TSan does not support multi-threaded fork
77 # TSan may open fds so "surface_creation_does_not_leak_fds" will not work as written
78 # TSan deadlocks when running StreamTransportTest/0.SendsFullMessagesWhenInterrupted - disable it until understood
79 set(test_exclusion_filter "UnresponsiveClient.does_not_hang_server:DemoInProcessServerWithStubClientPlatform.surface_creation_does_not_leak_fds:StreamTransportTest/0.SendsFullMessagesWhenInterrupted:BufferQueue/WithTwoOrMoreBuffers.client_framerate_matches_compositor*:BufferQueue/WithThreeOrMoreBuffers.slow_client_framerate_matches_compositor*:BufferQueue/WithThreeOrMoreBuffers.queue_size_scales_with_client_performance*")
80 endif()78 endif()
8179
82 if(SYSTEM_SUPPORTS_O_TMPFILE EQUAL 1)80 if(SYSTEM_SUPPORTS_O_TMPFILE EQUAL 1)
8381
=== modified file 'tools/tsan-suppressions'
--- tools/tsan-suppressions 2015-07-17 05:46:53 +0000
+++ tools/tsan-suppressions 2015-12-04 15:08:42 +0000
@@ -1,7 +1,4 @@
1race:libglib*1race:libglib*
2race:libgio*2race:libgio*
3race:testing::internal::FunctionMockerBase3race:testing::internal::FunctionMockerBase
4race:~posix_event4race:std::__future_base::_State_baseV2::wait()
5race:boost::asio::detail::posix_event::signal_and_unlock
6#Suppress false positive when deleting main loop shared_ptr
7race:std::__shared_ptr<mir::MainLoop, (__gnu_cxx::_Lock_policy)2>::operator->()
8\ No newline at end of file5\ No newline at end of file

Subscribers

People subscribed via source and target branches