Skip to content

Commit facb416

Browse files
author
MarcoFalke
committed
ci: Add valgrind run
1 parent 3d67527 commit facb416

6 files changed

+123
-6
lines changed

.travis.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
FILE_ENV="./ci/test/00_setup_env_native_centos.sh"
111111
112112
- stage: test
113-
name: 'x86_64 Linux [GOAL: install] [bionic] [uses qt5 dev package instead of depends Qt to speed up build and avoid timeout] [unsigned char]'
113+
name: 'x86_64 Linux [GOAL: install] [bionic] [uses qt5 dev package and some depends packages] [unsigned char]'
114114
env: >-
115115
FILE_ENV="./ci/test/00_setup_env_native_qt5.sh"
116116
@@ -125,6 +125,11 @@ jobs:
125125
env: >-
126126
FILE_ENV="./ci/test/00_setup_env_native_asan.sh"
127127
128+
- stage: test
129+
name: 'x86_64 Linux [GOAL: install] [bionic] [no depends, only system libs, valgrind]'
130+
env: >-
131+
FILE_ENV="./ci/test/00_setup_env_native_valgrind.sh"
132+
128133
- stage: test
129134
name: 'x86_64 Linux [GOAL: install] [bionic] [no depends, only system libs, sanitizers: fuzzer,address,undefined]'
130135
env: >-
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2019 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
7+
export LC_ALL=C.UTF-8
8+
9+
export PACKAGES="valgrind clang llvm python3-zmq 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"
10+
export USE_VALGRIND=1
11+
export NO_DEPENDS=1
12+
export TEST_RUNNER_EXTRA="p2p_segwit.py" # Only run one test for now. TODO enable all and bump timeouts
13+
export RUN_FUNCTIONAL_TESTS=true
14+
export GOAL="install"
15+
export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no CC=clang CXX=clang++" # TODO enable GUI

ci/test/04_install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=
4141
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
4242
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
4343
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
44-
env | grep -E '^(BITCOIN_CONFIG|CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS)' | tee /tmp/env
44+
env | grep -E '^(BITCOIN_CONFIG|BASE_|CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS)' | tee /tmp/env
4545
if [[ $HOST = *-mingw32 ]]; then
4646
DOCKER_ADMIN="--cap-add SYS_ADMIN"
4747
elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764)

ci/test/06_script_b.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export LC_ALL=C.UTF-8
88

99
if [ -n "$QEMU_USER_CMD" ]; then
1010
BEGIN_FOLD wrap-qemu
11-
echo "Prepare to run functional tests for HOST=$HOST"
1211
# Generate all binaries, so that they can be wrapped
1312
DOCKER_EXEC make $MAKEJOBS -C src/secp256k1 VERBOSE=1
1413
DOCKER_EXEC make $MAKEJOBS -C src/univalue VERBOSE=1
@@ -25,6 +24,12 @@ if [ -n "$QEMU_USER_CMD" ]; then
2524
END_FOLD
2625
fi
2726

27+
if [ -n "$USE_VALGRIND" ]; then
28+
BEGIN_FOLD wrap-valgrind
29+
DOCKER_EXEC "${BASE_ROOT_DIR}/ci/test/wrap-valgrind.sh"
30+
END_FOLD
31+
fi
32+
2833
if [ "$RUN_UNIT_TESTS" = "true" ]; then
2934
BEGIN_FOLD unit-tests
3035
bash -c "${CI_WAIT}" & # Print dots in case the unit tests take a long time to run

ci/test/wrap-valgrind.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2018 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
7+
export LC_ALL=C.UTF-8
8+
9+
for b_name in "${BASE_OUTDIR}/bin"/*; do
10+
# shellcheck disable=SC2044
11+
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name $(basename $b_name)); do
12+
echo "Wrap $b ..."
13+
mv "$b" "${b}_orig"
14+
echo '#!/usr/bin/env bash' > "$b"
15+
echo "valgrind --gen-suppressions=all --quiet --error-exitcode=1 --suppressions=${BASE_ROOT_DIR}/contrib/valgrind.supp \"${b}_orig\" \"\$@\"" >> "$b"
16+
chmod +x "$b"
17+
done
18+
done

contrib/valgrind.supp

+77-3
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,58 @@
3030
Memcheck:Cond
3131
obj:*/libdb_cxx-*.so
3232
fun:__log_put
33-
obj:*/libdb_cxx-*.so
34-
fun:__log_put_record
3533
}
3634
{
3735
Suppress libdb warning
3836
Memcheck:Param
3937
pwrite64(buf)
4038
fun:pwrite
4139
fun:__os_io
40+
}
41+
{
42+
Suppress libdb warning
43+
Memcheck:Cond
44+
fun:__log_putr.isra.1
45+
}
46+
{
47+
Suppress libdb warning
48+
Memcheck:Param
49+
pwrite64(buf)
50+
fun:pwrite
51+
fun:__os_io
52+
obj:*/libdb_cxx-*.so
53+
}
54+
{
55+
Suppress uninitialized bytes warning in compat code
56+
Memcheck:Param
57+
ioctl(TCSET{S,SW,SF})
58+
fun:tcsetattr
59+
}
60+
{
61+
Suppress libdb warning
62+
Memcheck:Leak
63+
fun:malloc
64+
...
4265
obj:*/libdb_cxx-*.so
4366
}
67+
{
68+
Suppress leaks on init
69+
Memcheck:Leak
70+
...
71+
fun:_Z11AppInitMainR11NodeContext
72+
}
73+
{
74+
Suppress leaks on shutdown
75+
Memcheck:Leak
76+
...
77+
fun:_Z8ShutdownR11NodeContext
78+
}
79+
{
80+
Ignore GUI warning
81+
Memcheck:Leak
82+
...
83+
obj:/usr/lib64/libgdk-3.so.0.2404.7
84+
}
4485
{
4586
Suppress leveldb warning (leveldb::InitModule()) - https://github.com/google/leveldb/issues/113
4687
Memcheck:Leak
@@ -56,24 +97,57 @@
5697
...
5798
fun:_ZN7leveldbL14InitDefaultEnvEv
5899
}
100+
{
101+
Suppress leveldb leak
102+
Memcheck:Leak
103+
match-leak-kinds: reachable
104+
fun:_Znwm
105+
...
106+
fun:_ZN7leveldb6DBImpl14BackgroundCallEv
107+
}
108+
{
109+
Suppress leveldb leak
110+
Memcheck:Leak
111+
fun:_Znwm
112+
...
113+
fun:GetCoin
114+
}
59115
{
60116
Suppress wcsnrtombs glibc SSE4 warning (could be related: https://stroika.atlassian.net/browse/STK-626)
61117
Memcheck:Addr16
62118
fun:__wcsnlen_sse4_1
63119
fun:wcsnrtombs
64120
}
121+
{
122+
Suppress wcsnrtombs warning (remove after removing boost::fs)
123+
Memcheck:Cond
124+
...
125+
fun:_ZN5boost10filesystem6detail11unique_pathERKNS0_4pathEPNS_6system10error_codeE
126+
fun:unique_path
127+
}
128+
{
129+
Suppress boost warning
130+
Memcheck:Leak
131+
fun:_Znwm
132+
...
133+
fun:_ZN5boost9unit_test9framework5state17execute_test_treeEmjPKNS2_23random_generator_helperE
134+
fun:_ZN5boost9unit_test9framework3runEmb
135+
fun:_ZN5boost9unit_test14unit_test_mainEPFbvEiPPc
136+
fun:main
137+
}
65138
{
66139
Suppress boost::filesystem warning (fixed in boost 1.70: https://github.com/boostorg/filesystem/commit/bbe9d1771e5d679b3f10c42a58fc81f7e8c024a9)
67140
Memcheck:Cond
68141
fun:_ZN5boost10filesystem6detail28directory_iterator_incrementERNS0_18directory_iteratorEPNS_6system10error_codeE
69-
fun:_ZN5boost10filesystem6detail28directory_iterator_constructERNS0_18directory_iteratorERKNS0_4pathEPNS_6system10error_codeE
142+
...
70143
obj:*/libboost_filesystem.so.*
71144
}
72145
{
73146
Suppress boost::filesystem warning (could be related: https://stackoverflow.com/questions/9830182/function-boostfilesystemcomplete-being-reported-as-possible-memory-leak-by-v)
74147
Memcheck:Leak
75148
match-leak-kinds: reachable
76149
fun:_Znwm
150+
...
77151
fun:_ZN5boost10filesystem8absoluteERKNS0_4pathES3_
78152
}
79153
{

0 commit comments

Comments
 (0)