Page MenuHomePhabricator

test: Use test_bitcoin setup in bench
ClosedPublic

Authored by Fabien on Tue, Mar 17, 11:08.

Details

Reviewers
jasonbcox
Group Reviewers
Restricted Project
Commits
rABCb6a8418acfa6: test: Use test_bitcoin setup in bench
Summary
Now that the fuzz tests can use the BasicTestingSetup [1], do the same
for bench.

Partial backport of core PR15788:
https://github.com/bitcoin/bitcoin/pull/15788/commits/fa8685d49ed8e52b1220a89f669dac63bef172bc

This is stripped down to using the test fixture for the benchmark, as we
have no use for the utils for now.

Depends on D5484.

Test Plan
make
make check
./src/bench/bench_bitcoin

ninja
ninja check
ninja bench-bitcoin

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Tue, Mar 17, 11:08
Herald added a reviewer: Restricted Project. · View Herald TranscriptTue, Mar 17, 11:08
teamcity edited the summary of this revision. (Show Details)Tue, Mar 17, 11:08

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

Fabien retitled this revision from test: Use test_bitcoin setup in bench, Add test utils to test: Use test_bitcoin setup in bench.Tue, Mar 17, 11:08

Snippet of first build failure:

[11:09:01] :	 [Step 1/1] [326/441] Building CXX object src/CMakeFiles/server.dir/txdb.cpp.o
[11:09:02] :	 [Step 1/1] [327/441] Building CXX object src/CMakeFiles/server.dir/rest.cpp.o
[11:09:03] :	 [Step 1/1] [328/441] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[11:09:03] :	 [Step 1/1] [329/441] Linking CXX executable src/bitcoin-tx
[11:09:04] :	 [Step 1/1] [330/441] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[11:09:04] :	 [Step 1/1] [331/441] Building CXX object src/wallet/CMakeFiles/wallet.dir/init.cpp.o
[11:09:07] :	 [Step 1/1] [332/441] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[11:09:08] :	 [Step 1/1] [333/441] Building CXX object src/wallet/CMakeFiles/wallet.dir/__/interfaces/wallet.cpp.o
[11:09:11] :	 [Step 1/1] [334/441] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[11:09:12] :	 [Step 1/1] [335/441] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[11:09:15] :	 [Step 1/1] [336/441] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[11:09:16] :	 [Step 1/1] [337/441] Linking CXX static library src/wallet/libwallet.a
[11:09:16] :	 [Step 1/1] [338/441] Linking CXX static library src/libserver.a
[11:09:17] :	 [Step 1/1] [339/441] data/block413567.raw
[11:09:17] :	 [Step 1/1] [340/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/base58.cpp.o
[11:09:17] :	 [Step 1/1] [341/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/cashaddr.cpp.o
[11:09:17] :	 [Step 1/1] [342/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/ccoins_caching.cpp.o
[11:09:17] :	 [Step 1/1] [343/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/checkqueue.cpp.o
[11:09:17] :	 [Step 1/1] [344/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/crypto_aes.cpp.o
[11:09:17] :	 [Step 1/1] [345/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/crypto_hash.cpp.o
[11:09:17] :	 [Step 1/1] [346/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/examples.cpp.o
[11:09:17] :	 [Step 1/1] [347/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/gcs_filter.cpp.o
[11:09:17] :	 [Step 1/1] [348/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/mempool_eviction.cpp.o
[11:09:17] :	 [Step 1/1] [349/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/merkle_root.cpp.o
[11:09:17] :	 [Step 1/1] [350/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/prevector.cpp.o
[11:09:17] :	 [Step 1/1] [351/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/rpc_mempool.cpp.o
[11:09:17] :	 [Step 1/1] [352/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/coin_selection.cpp.o
[11:09:17] :	 [Step 1/1] [353/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/util_time.cpp.o
[11:09:17] :	 [Step 1/1] [354/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/checkblock.cpp.o
[11:09:18] :	 [Step 1/1] [355/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/rollingbloom.cpp.o
[11:09:18] :	 [Step 1/1] [356/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/lockedpool.cpp.o
[11:09:18] :	 [Step 1/1] [357/441] Linking CXX executable src/bitcoind
[11:09:19] :	 [Step 1/1] [358/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/duplicate_inputs.cpp.o
[11:09:19] :	 [Step 1/1] FAILED: src/bench/CMakeFiles/bitcoin-bench.dir/duplicate_inputs.cpp.o 
[11:09:19] :	 [Step 1/1] /usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../src/. -Isrc -I../src/univalue/include -Isrc/crypto/.. -I../src/secp256k1/include -I../src/leveldb/include -isystem /usr/include/miniupnpc -g -O2 -fPIE -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++14 -MD -MT src/bench/CMakeFiles/bitcoin-bench.dir/duplicate_inputs.cpp.o -MF src/bench/CMakeFiles/bitcoin-bench.dir/duplicate_inputs.cpp.o.d -o src/bench/CMakeFiles/bitcoin-bench.dir/duplicate_inputs.cpp.o -c ../src/bench/duplicate_inputs.cpp
[11:09:19] :	 [Step 1/1] ../src/bench/duplicate_inputs.cpp:20:10: fatal error: test/util.h: No such file or directory
[11:09:19] :	 [Step 1/1]  #include <test/util.h>
[11:09:19] :	 [Step 1/1]           ^~~~~~~~~~~~~
[11:09:19] :	 [Step 1/1] compilation terminated.
[11:09:19] :	 [Step 1/1] [359/441] Automatic MOC for target bitcoin-qt-base
[11:09:19] :	 [Step 1/1] [360/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/bench_bitcoin.cpp.o
[11:09:20] :	 [Step 1/1] [361/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/bench.cpp.o
[11:09:20] :	 [Step 1/1] FAILED: src/bench/CMakeFiles/bitcoin-bench.dir/bench.cpp.o 
[11:09:20] :	 [Step 1/1] /usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../src/. -Isrc -I../src/univalue/include -Isrc/crypto/.. -I../src/secp256k1/include -I../src/leveldb/include -isystem /usr/include/miniupnpc -g -O2 -fPIE -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++14 -MD -MT src/bench/CMakeFiles/bitcoin-bench.dir/bench.cpp.o -MF src/bench/CMakeFiles/bitcoin-bench.dir/bench.cpp.o.d -o src/bench/CMakeFiles/bitcoin-bench.dir/bench.cpp.o -c ../src/bench/bench.cpp
[11:09:20] :	 [Step 1/1] In file included from /usr/include/c++/8/cassert:44,
[11:09:20] :	 [Step 1/1]                  from ../src/bench/bench.cpp:12:
[11:09:20] :	 [Step 1/1] ../src/bench/bench.cpp: In static member function 'static void benchmark::BenchRunner::RunAll(benchmark::Printer&, uint64_t, double, const string&, bool)':
[11:09:20] :	 [Step 1/1] ../src/bench/bench.cpp:118:20: error: '::chainActive' has not been declared
[11:09:20] :	 [Step 1/1]          { assert(::chainActive.Height() == 0); }
[11:09:20] :	 [Step 1/1]                     ^~~~~~~~~~~
[11:09:24] :	 [Step 1/1] [362/441] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/__/test/test_bitcoin.cpp.o
[11:09:24] :	 [Step 1/1] ninja: build stopped: subcommand failed.
[11:09:24]W:	 [Step 1/1] ++ print_sanitizers_log
[11:09:24]W:	 [Step 1/1] ++ for log in "${SAN_LOG_DIR}"/*.log.*
[11:09:24]W:	 [Step 1/1] ++ echo '*** Output of /tmp/sanitizer_logs/*.log.* ***'
[11:09:24]W:	 [Step 1/1] ++ cat '/tmp/sanitizer_logs/*.log.*'
[11:09:24]W:	 [Step 1/1] cat: '/tmp/sanitizer_logs/*.log.*': No such file or directory
[11:09:24] :	 [Step 1/1] *** Output of /tmp/sanitizer_logs/*.log.* ***
[11:09:24]W:	 [Step 1/1] Process exited with code 1
[11:09:24]E:	 [Step 1/1] Process exited with code 1 (Step: Command Line)
Fabien planned changes to this revision.Tue, Mar 17, 11:18
Fabien updated this revision to Diff 16971.Tue, Mar 17, 13:05

Fix various issues.

Fabien added inline comments.Tue, Mar 17, 13:06
src/Makefile.bench.include
43 ↗(On Diff #16971)

Needed to make bench link with autotools. Core still has it, and it is missing due to out of order backports.

jasonbcox requested changes to this revision.Tue, Mar 17, 20:27
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
src/bench/bench.cpp
119 ↗(On Diff #16971)

This doesn't require it's own scope.

This revision now requires changes to proceed.Tue, Mar 17, 20:27
Fabien updated this revision to Diff 16991.Wed, Mar 18, 08:04

Remove unnecessary scope.

jasonbcox accepted this revision.Wed, Mar 18, 23:59
This revision is now accepted and ready to land.Wed, Mar 18, 23:59
This revision was automatically updated to reflect the committed changes.