dash/ci/test/00_setup_env_native_tsan.sh

19 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
#
# Copyright (c) 2019-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_native_tsan
export PACKAGES="clang-8 llvm-8 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev"
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
export TEST_RUNNER_EXTRA="--extended --exclude feature_pruning,feature_dbcrash,wallet_multiwallet.py" # Temporarily suppress ASan heap-use-after-free (see issue #14163)
export GOAL="install"
ci: build TSan with clang 15 and add -Werror=thread-safety, fix-up stacktraces (#5375) ## Description Pull request was inspired by the need to debug lock problems when working on https://github.com/dashpay/dash/pull/5352. As far as I'm aware, only macOS has `-Werror=thread-safety` as part of its default `CXXFLAGS` despite the capability being present on Linux as well. This PR introduces thread safety checks for that into our thread sanitizer build. Additionally, since we're using Clang, something that on first glimpse, appears to be something that `stacktraces.cpp` isn't happy with, due to `-Wl,-wrap` being available only on GCC, that no longer seems to be the case, since the version of Clang with comes with `focal`, its `lld` _does_ have support for `-wrap` (see [man page for `lld` on `focal`](https://manpages.ubuntu.com/manpages/focal/en/man1/lld.1.html)). The current `stable` version of Clang/LLVM is 15, at the time of this pull request (see https://apt.llvm.org/) but `focal` ships with an older version, requiring us to use the official LLVM APT repository. I feel we should be testing with recent compilers alongside the ones shipped by LTS distributions. Certain bugs are only made apparent when testing on rolling release distros or distros that have faster update cycles, like Fedora (see https://github.com/dashpay/dash/pull/5295 for an illustration of that), which ship with more recent compilers. Until we overhaul our CI systems to test using those distros directly (our current infrastructure is centered around using a "development image" with an LTS distro as the base), this is the best we can do. A similar pull request testing against the latest GCC stable will be welcome as that is currently outside the scope of this PR as the changes made were to make sure that builds were operating as expected on Clang/LLVM 15. --------- Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-05-26 20:49:29 +02:00
export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --enable-suppress-external-warnings --with-sanitizers=thread"
export BITCOIN_CONFIG="${BITCOIN_CONFIG} CC=clang-15 CXX=clang++-15 CXXFLAGS=-Werror=thread-safety"
export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG"
export PYZMQ=true
export RUN_SYMBOL_TESTS=false