Skip to content

Commit 600b85b

Browse files
author
MarcoFalke
committed
Merge #14794: tests: Add AddressSanitizer (ASan) Travis build
6541d59 Add LSan suppression warnings (practicalswift) ff7212e Add ASan Travis build (practicalswift) ebd3bf2 Make test p2p_invalid_messages.py pass: Allow for expected Travis ASAN memory increase (practicalswift) Pull request description: Add ASan Travis build. Tree-SHA512: b9712aaf0c9112b637b6ef0c5d93961863dcbecaf31d9561eb09258a61540fb31d2c8ecae86518a82763279e4aa6cac266cd352c2b2507df0335c0199f8b3d78
2 parents fdf146f + 6541d59 commit 600b85b

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
9393
GOAL="install"
9494
BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\""
95-
# x86_64 Linux (xenial, no depends, only system libs, sanitizers: thread (TSAN))
95+
# x86_64 Linux (xenial, no depends, only system libs, sanitizers: thread (TSan))
9696
- stage: test
9797
env: >-
9898
HOST=x86_64-unknown-linux-gnu
@@ -102,14 +102,15 @@ jobs:
102102
RUN_FUNCTIONAL_TESTS=false # Disabled for now. TODO identify suppressions or exclude specific tests
103103
GOAL="install"
104104
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=thread --disable-hardening --disable-asm CC=clang CXX=clang++"
105-
# x86_64 Linux (no depends, only system libs, sanitizers: undefined (UBSAN) + integer)
105+
# x86_64 Linux (no depends, only system libs, sanitizers: address/leak (ASan + LSan) + undefined (UBSan) + integer)
106106
- stage: test
107107
env: >-
108108
HOST=x86_64-unknown-linux-gnu
109109
PACKAGES="clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
110110
NO_DEPENDS=1
111+
FUNCTIONAL_TESTS_CONFIG="--exclude wallet_multiwallet.py" # Temporarily suppress ASan heap-use-after-free (see issue #14163)
111112
GOAL="install"
112-
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=integer,undefined CC=clang CXX=clang++"
113+
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"
113114
# x86_64 Linux, No wallet
114115
- stage: test
115116
env: >-

.travis/test_04_install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
export LC_ALL=C.UTF-8
88

99
travis_retry docker pull "$DOCKER_NAME_TAG"
10+
export ASAN_OPTIONS=""
11+
export LSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/lsan"
1012
export TSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/tsan"
1113
export UBSAN_OPTIONS="suppressions=${TRAVIS_BUILD_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1"
12-
env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(TSAN|UBSAN)_OPTIONS)' | tee /tmp/env
14+
env | grep -E '^(BITCOIN_CONFIG|CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS)' | tee /tmp/env
1315
if [[ $HOST = *-mingw32 ]]; then
1416
DOCKER_ADMIN="--cap-add SYS_ADMIN"
1517
fi

.travis/test_06_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ fi
5656

5757
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
5858
BEGIN_FOLD functional-tests
59-
DOCKER_EXEC test/functional/test_runner.py --ci --combinedlogslen=4000 --coverage --quiet --failfast ${extended}
59+
DOCKER_EXEC test/functional/test_runner.py --ci --combinedlogslen=4000 --coverage --quiet --failfast ${extended} ${FUNCTIONAL_TESTS_CONFIG}
6060
END_FOLD
6161
fi

test/functional/p2p_invalid_messages.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test node responses to invalid network messages."""
6+
import os
67
import struct
78

89
from test_framework import messages
@@ -66,7 +67,10 @@ def run_test(self):
6667
msg_at_size = msg_unrecognized("b" * valid_data_limit)
6768
assert len(msg_at_size.serialize()) == msg_limit
6869

69-
with node.assert_memory_usage_stable(increase_allowed=0.5):
70+
increase_allowed = 0.5
71+
if [s for s in os.environ.get("BITCOIN_CONFIG", "").split(" ") if "--with-sanitizers" in s and "address" in s]:
72+
increase_allowed = 3.5
73+
with node.assert_memory_usage_stable(increase_allowed=increase_allowed):
7074
self.log.info(
7175
"Sending a bunch of large, junk messages to test "
7276
"memory exhaustion. May take a bit...")

test/sanitizer_suppressions/lsan

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Suppress warnings about addCoin(...) leak in the CoinSelection benchmark
2+
leak:addCoin
3+
leak:bench_bitcoin
4+
5+
# Suppress warnings triggered in dependencies
6+
leak:libcrypto
7+
leak:libqminimal
8+
leak:libQt5Core
9+
leak:libQt5Gui
10+
leak:libQt5Widgets

0 commit comments

Comments
 (0)