Steps to reproduce on a fresh install of Ubuntu LTS 24.04:
- Install packages and clone repo:
( export DEBIAN_FRONTEND=noninteractive && apt update && apt install git ccache make build-essential libtool cmake autotools-dev automake pkg-config bsdmainutils python3 libevent-dev libboost-dev libsqlite3-dev valgrind -y && git clone https://github.com/bitcoin/bitcoin.git b-c ) && cd b-c
git checkout 338bc2cd261ba3daf7fb494f8cb4a534762e292c # cmake migration (allows to test autotools and cmake on the same commit)
- Apply a diff to create more function calls in one hotspot (optional):
0diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
1index c2c725d676..704c060749 100644
2--- a/src/test/util_tests.cpp
3+++ b/src/test/util_tests.cpp
4@@ -273,13 +273,15 @@ BOOST_AUTO_TEST_CASE(util_ReplaceAll)
5 ReplaceAll(test, search, substitute);
6 BOOST_CHECK_EQUAL(test, expected);
7 };
8-
9+ int i{10000};
10+while (i-->0){
11 test_replaceall("", "foo", original);
12 test_replaceall(original, "foo", "foo");
13 test_replaceall("%s", "foo", "A test \"foo\" string 'foo'.");
14 test_replaceall("\"", "foo", "A test foo%sfoo string '%s'.");
15 test_replaceall("'", "foo", "A test \"%s\" string foo%sfoo.");
16 }
17+}
18
19 BOOST_AUTO_TEST_CASE(util_TrimString)
20 {
- Then create two out-of-tree builds, run a test in callgrind, and annotate it:
./autogen.sh && rm -rf ./bld-a && mkdir bld-a && ( cd bld-a && ../configure && make -j$(nproc) )
rm -rf ./bld-c && cmake -B ./bld-c && cmake --build ./bld-c -j $(nproc)
valgrind --tool=callgrind --callgrind-out-file=cg-a-%p.out ./bld-a/src/test/test_bitcoin -t util_tests/util_ReplaceAll
valgrind --tool=callgrind --callgrind-out-file=cg-c-%p.out ./bld-c/src/test/test_bitcoin -t util_tests/util_ReplaceAll
callgrind_annotate ./cg-a-40328.out
callgrind_annotate ./cg-c-39984.out
The cmake version of the last call will print a warning:
0--------------------------------------------------------------------------------
1The following files chosen for auto-annotation could not be found:
2--------------------------------------------------------------------------------
3 ./bld-c/src/crypto/./src/compat/byteswap.h
4 ./bld-c/src/crypto/./src/crypto/sha256.cpp
5 ./bld-c/src/crypto/./src/crypto/sha512.cpp
6 ./bld-c/src/test/./src/test/crypto_tests.cpp
7 ./bld-c/src/test/./src/test/util_tests.cpp
8 ./bld-c/src/util/./src/random.cpp
9 ./bld-c/src/util/./src/util/string.cpp
10...
It also seems not possible to fix with --include=dir
, as the path look a bit odd (non-existing)