diff --git a/contrib/teamcity/build.sh b/contrib/teamcity/build.sh index d38c26da4..88233341a 100755 --- a/contrib/teamcity/build.sh +++ b/contrib/teamcity/build.sh @@ -1,76 +1,83 @@ #!/bin/bash set -eu TOPLEVEL=`git rev-parse --show-toplevel` if [[ -z "${TOPLEVEL}" ]]; then echo "No .git directory found, assuming pwd" TOPLEVEL=`pwd -P` fi BUILD_DIR="${TOPLEVEL}/build" mkdir -p ${BUILD_DIR} ## Generate necessary autoconf files cd ${TOPLEVEL} ./autogen.sh cd ${BUILD_DIR} rm -f build.status test_bitcoin.xml ## Determine the number of build threads THREADS=$(nproc || sysctl -n hw.ncpu) # Default to nothing : ${DISABLE_WALLET:=} : ${CONFIGURE_FLAGS:=} CONFIGURE_FLAGS+=("--prefix=`pwd`") if [[ ! -z "${DISABLE_WALLET}" ]]; then echo "*** Building without wallet" CONFIGURE_FLAGS+=("--disable-wallet") fi # Default to nothing : ${ENABLE_DEBUG:=} if [[ ! -z "${ENABLE_DEBUG}" ]]; then echo "*** Building with debug" CONFIGURE_FLAGS+=("--enable-debug") fi ../configure "${CONFIGURE_FLAGS[@]}" +# Sanitizers options, not used if sanitizers are not enabled +SAN_SUPP_DIR="${TOPLEVEL}/test/sanitizer_suppressions" +export ASAN_OPTIONS="" +export LSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/lsan" +export TSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/tsan" +export UBSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/ubsan:print_stacktrace=1:halt_on_error=1" + # Run build make -j ${THREADS} # Default to nothing : ${DISABLE_TESTS:=} # If DISABLE_TESTS is unset (default), run the tests if [[ -z "${DISABLE_TESTS}" ]]; then echo "*** Running tests" # Run unit tests make -j ${THREADS} check # FIXME Remove when the functional tests are running with debug enabled if [[ -z "${ENABLE_DEBUG}" ]]; then mkdir -p output/ BRANCH=$(git rev-parse --abbrev-ref HEAD) if [[ ! -z "${DISABLE_WALLET}" ]]; then echo "Skipping rpc testing due to disabled wallet functionality." elif [[ "${BRANCH}" == "master" ]]; then ./test/functional/test_runner.py --cutoff=600 --tmpdirprefix=output ./test/functional/test_runner.py --cutoff=600 --tmpdirprefix=output --with-gravitonactivation else ./test/functional/test_runner.py --tmpdirprefix=output ./test/functional/test_runner.py --tmpdirprefix=output --with-gravitonactivation fi else echo "*** Functional tests have been skipped" fi else echo "*** Tests have been skipped" fi diff --git a/test/sanitizer_suppressions/lsan b/test/sanitizer_suppressions/lsan new file mode 100644 index 000000000..90a92a511 --- /dev/null +++ b/test/sanitizer_suppressions/lsan @@ -0,0 +1,9 @@ +# Suppress warnings triggered in dependencies +leak:libcrypto +leak:libqminimal +leak:libQt5Core +leak:libQt5Gui +leak:libQt5Widgets + +# false-positive due to use of secure_allocator<> +leak:GetRNGState diff --git a/test/sanitizer_suppressions/tsan b/test/sanitizer_suppressions/tsan new file mode 100644 index 000000000..70eea3436 --- /dev/null +++ b/test/sanitizer_suppressions/tsan @@ -0,0 +1,16 @@ +# ThreadSanitizer suppressions +# ============================ + +# WalletBatch (unidentified deadlock) +deadlock:WalletBatch + +# Intentional deadlock in tests +deadlock:TestPotentialDeadLockDetected + +# Wildcard for all gui tests, should be replaced with non-wildcard suppressions +race:src/qt/test/* +deadlock:src/qt/test/* + +# External libraries +deadlock:libdb +race:libzmq diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan new file mode 100644 index 000000000..643272de5 --- /dev/null +++ b/test/sanitizer_suppressions/ubsan @@ -0,0 +1,35 @@ +alignment:move.h +alignment:prevector.h +bool:wallet/wallet.cpp +float-divide-by-zero:policy/fees.cpp +float-divide-by-zero:validation.cpp +float-divide-by-zero:wallet/wallet.cpp +unsigned-integer-overflow:arith_uint256.h +unsigned-integer-overflow:basic_string.h +unsigned-integer-overflow:bench/bench.h +unsigned-integer-overflow:bitcoin-tx.cpp +unsigned-integer-overflow:bloom.cpp +unsigned-integer-overflow:chain.cpp +unsigned-integer-overflow:chain.h +unsigned-integer-overflow:coded_stream.h +unsigned-integer-overflow:core_write.cpp +unsigned-integer-overflow:crypto/chacha20.cpp +unsigned-integer-overflow:crypto/ctaes/ctaes.c +unsigned-integer-overflow:crypto/poly1305.cpp +unsigned-integer-overflow:crypto/ripemd160.cpp +unsigned-integer-overflow:crypto/sha1.cpp +unsigned-integer-overflow:crypto/sha256.cpp +unsigned-integer-overflow:crypto/sha512.cpp +unsigned-integer-overflow:hash.cpp +unsigned-integer-overflow:leveldb/db/log_reader.cc +unsigned-integer-overflow:leveldb/util/bloom.cc +unsigned-integer-overflow:leveldb/util/crc32c.h +unsigned-integer-overflow:leveldb/util/hash.cc +unsigned-integer-overflow:policy/fees.cpp +unsigned-integer-overflow:prevector.h +unsigned-integer-overflow:script/interpreter.cpp +unsigned-integer-overflow:stl_bvector.h +unsigned-integer-overflow:txmempool.cpp +unsigned-integer-overflow:util/strencodings.cpp +unsigned-integer-overflow:validation.cpp +vptr:fs.cpp