You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2020/04/25 20:12:07 UTC

[qpid-proton] 01/04: PROTON-2133 Add and populate tsan suppressions and add tsan job in travis

This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 6217dfc52c0851b4a13e48fae60b1b55a5f33381
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Thu Nov 7 13:50:54 2019 +0100

    PROTON-2133 Add and populate tsan suppressions and add tsan job in travis
    
    * lowercase the test_env CMake variable where it was previously uppercase
    * add the ${PN_ENV_SCRIPT} to every test command that uses ${test_env}
    
    Otherwise I'd get
    
        Could not find executable TSAN_OPTIONS=second_deadlock_stack=1 suppressions=/home/jdanek/repos/qpid/qpid-proton/tests/tsan.supp
        Looked in the following places:
        TSAN_OPTIONS=second_deadlock_stack=1 suppressions=/home/jdanek/repos/qpid/qpid-proton/tests/tsan.supp
        ...
---
 .travis.yml              |  3 +++
 tests/RuntimeCheck.cmake |  2 ++
 tests/preload_tsan.sh    | 39 +++++++++++++++++++++++++++++++++++++++
 tests/tsan.supp          | 28 ++++++++++++++++++++++++++++
 4 files changed, 72 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 881ad34..b6c5466 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,6 +29,9 @@ matrix:
   include:
   - os: linux
     env:
+    - QPID_PROTON_CMAKE_ARGS='-DRUNTIME_CHECK=tsan'
+  - os: linux
+    env:
     - QPID_PROTON_CMAKE_ARGS='-DCMAKE_BUILD_TYPE=Coverage'
     after_success:
     - bash <(curl -s https://codecov.io/bash)
diff --git a/tests/RuntimeCheck.cmake b/tests/RuntimeCheck.cmake
index aed4900..b2f9233 100644
--- a/tests/RuntimeCheck.cmake
+++ b/tests/RuntimeCheck.cmake
@@ -103,6 +103,8 @@ elseif(RUNTIME_CHECK STREQUAL "tsan")
   assert_has_sanitizers()
   message(STATUS "Runtime race checker: gcc/clang thread sanitizer")
   set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
+  set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_tsan.sh $<TARGET_FILE:qpid-proton-core>")
+  list(APPEND TEST_ENV "TSAN_OPTIONS=second_deadlock_stack=1 suppressions=${CMAKE_SOURCE_DIR}/tests/tsan.supp")
 
 elseif(RUNTIME_CHECK)
   message(FATAL_ERROR "'RUNTIME_CHECK=${RUNTIME_CHECK}' is invalid, valid values: ${runtime_checks}")
diff --git a/tests/preload_tsan.sh b/tests/preload_tsan.sh
new file mode 100755
index 0000000..157c2cf
--- /dev/null
+++ b/tests/preload_tsan.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+if test $# -lt 2; then
+    echo <<EOF
+usage: $0 LIB EXE [args ...]
+Get the libtsan linked to LIB and preload it to run `EXE args ...`
+EOF
+fi
+
+LIB=$1; shift
+EXE=$2
+
+# Preload the tsan library linked to LIB. Note we need to
+# check the actual linkage, there may be multiple tsan lib
+# versions installed and we must use the same one.
+
+libtsan=$(ldd "$LIB" | awk "/(tsan.*\\.so[.0-9]*)/ { print \$3 }")
+LD_PRELOAD="$libtsan:$LD_PRELOAD"
+export LD_PRELOAD
+
+exec "$@"
diff --git a/tests/tsan.supp b/tests/tsan.supp
new file mode 100644
index 0000000..07b3fdb
--- /dev/null
+++ b/tests/tsan.supp
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# ThreadSanitizer (tsan) suppression file
+#  https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions
+
+# PROTON-2133 in c/src/proactor/epoll.c
+race:^stop_polling$
+
+# PROTON-2133 in close (also match with .c/.cpp at the end)
+race:c/examples/broker
+race:cpp/examples/broker


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org