From fadb77169bed77e0df8d42d55599615b916ee6e8 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 16 Feb 2026 10:44:28 +0100 Subject: [PATCH 1/3] test: Scale feature_dbcrash.py timeout with factor This allows to run the test under valgrind: ./bld-cmake/test/functional/feature_dbcrash.py --timeout-factor=10 --valgrind For testing, the same test can be run multiple times in parallel: ./bld-cmake/test/functional/test_runner.py -j 10 $( printf 'feature_dbcrash.py %.0s' {1..10} ) --timeout-factor=10 --valgrind (Running the test under valgrind may take several hours!) I found that before this commit, 9 out of the 10 runs failed via: ``` ... TestFramework (INFO): Iteration 36, generating 2500 transactions [11, 5, 6] TestFramework (ERROR): Unexpected exception Traceback (most recent call last): File "/b-c/test/functional/test_framework/test_framework.py", line 142, in main self.run_test() ~~~~~~~~~~~~~^^ File "/b-c/bld-cmake/test/functional/feature_dbcrash.py", line 262, in run_test self.sync_node3blocks(block_hashes) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/b-c/bld-cmake/test/functional/feature_dbcrash.py", line 151, in sync_node3blocks nodei_utxo_hash = self.restart_node(i, block_hash) File "/b-c/bld-cmake/test/functional/feature_dbcrash.py", line 102, in restart_node raise AssertionError(f"Unable to successfully restart node {node_index} in allotted time") AssertionError: Unable to successfully restart node 0 in allotted time ``` With this commit, all 10 runs passed. --- test/functional/feature_dbcrash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/feature_dbcrash.py b/test/functional/feature_dbcrash.py index 7a60af40f49..cc94be781d1 100755 --- a/test/functional/feature_dbcrash.py +++ b/test/functional/feature_dbcrash.py @@ -80,7 +80,7 @@ class ChainstateWriteCrashTest(BitcoinTestFramework): after a timeout. Returns the utxo hash of the given node.""" time_start = time.time() - while time.time() - time_start < 120: + while time.time() - time_start < 120 * self.options.timeout_factor: try: # Any of these RPC calls could throw due to node crash self.start_node(node_index) From faf3ef4ee79ba4dc77340f47bf8eb303ef6ac825 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 10 Mar 2026 22:29:56 +0100 Subject: [PATCH 2/3] ci: Clarify why valgrind task has gui disabled A build with system libs (or with a normal depends build) will fail with: ```sh $ valgrind --exit-on-first-error=yes --error-exitcode=1 --quiet ./bld-cmake/bin/test_bitcoin-qt Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8. Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead. If this causes problems, reconfigure your locale. See the locale(1) manual for more information. ********* Start testing of AppTests ********* Config: Using QtTest library 6.10.2, Qt 6.10.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 15.2.0), ubuntu 26.04 PASS : AppTests::initTestCase() QINFO : AppTests::appTests() Backing up GUI settings to "/tmp/test_common bitcoin/60d474ffae390f81657d/regtest/guisettings.ini.bak" ==18007== Conditional jump or move depends on uninitialised value(s) ==18007== at 0x12655E26: ??? ==18007== by 0xCB28E7F: ??? ==18007== ==18007== ==18007== Exit program on first error (--exit-on-first-error=yes) ``` A DEBUG=1 depends build would work, but that seems tedious for questionable benefit. --- ci/test/00_setup_env_native_valgrind.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index 30c84bf4874..89118324b1c 100755 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -15,7 +15,7 @@ export NO_DEPENDS=1 # bind tests excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export TEST_RUNNER_EXTRA="--exclude rpc_bind --exclude feature_bind_extra" export GOAL="install" -# TODO enable GUI +# GUI disabled, because it only passes with a DEBUG=1 depends build export BITCOIN_CONFIG="\ --preset=dev-mode \ -DBUILD_GUI=OFF \ From fa70b9ebaa46b5fedcc02200626499d25762d44a Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Fri, 13 Feb 2026 13:46:08 +0100 Subject: [PATCH 3/3] ci: Temporarily use clang in valgrind tasks valgrind currently does not work on GCC -O2 compiled executables, which contain std::optional use, due to an upstream bug. See https://bugs.kde.org/show_bug.cgi?id=472329 One workaround could be to use -O1. However, that seems brittle, as variantions of the bug were seen with -O1 as well. So temporarily use clang in the valgrind CI tasks, because this also allows to drop a false-positive suppression for: -DCMAKE_CXX_FLAGS='-Wno-error=array-bounds' Also, update the comment in contrib/valgrind.supp to mention the background: * GCC -O2 wasn't tested with the suppressions file, due to the mentioned bug. * Clang-17 (or later) on aarch64 wasn't tested due to bug https://github.com/bitcoin/bitcoin/issues/29635 and the minimum supported clang version is clang-17 right now. * GUI isn't tested, because it requires a debug build, see the prior commit. This means the only tested config right now is the one mentioned in the suppression file. --- ci/test/00_setup_env_native_fuzz_with_valgrind.sh | 5 +++-- ci/test/00_setup_env_native_valgrind.sh | 6 ++++-- test/sanitizer_suppressions/valgrind.supp | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh index d8b0f5f1b5b..ed84ae84cf3 100755 --- a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh +++ b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:trixie" export CONTAINER_NAME=ci_native_fuzz_valgrind -export PACKAGES="libevent-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto" +export PACKAGES="clang llvm libclang-rt-dev libevent-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false @@ -17,5 +17,6 @@ export FUZZ_TESTS_CONFIG="--valgrind" export GOAL="all" export BITCOIN_CONFIG="\ -DBUILD_FOR_FUZZING=ON \ - -DCMAKE_CXX_FLAGS='-Wno-error=array-bounds' \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ " diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index 89118324b1c..0ca02f77824 100755 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:trixie" export CONTAINER_NAME=ci_native_valgrind -export PACKAGES="valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip" +export PACKAGES="clang llvm libclang-rt-dev valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip" export PIP_PACKAGES="--break-system-packages pycapnp" export USE_VALGRIND=1 export NO_DEPENDS=1 @@ -17,7 +17,9 @@ export TEST_RUNNER_EXTRA="--exclude rpc_bind --exclude feature_bind_extra" export GOAL="install" # GUI disabled, because it only passes with a DEBUG=1 depends build export BITCOIN_CONFIG="\ - --preset=dev-mode \ + --preset=dev-mode \ -DBUILD_GUI=OFF \ -DWITH_USDT=OFF \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ " diff --git a/test/sanitizer_suppressions/valgrind.supp b/test/sanitizer_suppressions/valgrind.supp index 584cdcf755e..8bcad9140e3 100644 --- a/test/sanitizer_suppressions/valgrind.supp +++ b/test/sanitizer_suppressions/valgrind.supp @@ -12,8 +12,10 @@ # --error-limit=no build/bin/test_bitcoin # # Note that suppressions may depend on OS and/or library versions. -# Tested on aarch64 and x86_64 with Ubuntu Noble system libs, using clang-16 -# and GCC, without gui. +# Tested on Debian Trixie system libs, +# * using clang (only x86_64, see https://bugs.kde.org/show_bug.cgi?id=485276), +# * and GCC (only -O1, see https://bugs.kde.org/show_bug.cgi?id=472329), +# without gui (because it only passes with a DEBUG=1 depends build). { Suppress leaks on shutdown Memcheck:Leak