Merge bitcoin/bitcoin#33142: test: Run bench sanity checks in parallel with functional tests

fa65bc0e79 test: Run bench sanity checks in parallel with functional tests (MarcoFalke)
fa9fdbce79 test: Pass bench exe into test framework utils (MarcoFalke)

Pull request description:

  The ctest target `bench_sanity_check` has many issues:

  * With sanitizers enabled, it is one of the slowest targets, often taking several minutes. See https://github.com/bitcoin/bitcoin/issues/32770#issuecomment-2984264066.
  * There is no insight from ctest into how long each individual sanity check takes.
  * On a timeout, or OOM issue, there is no insight into which sub-bench failed. The failure will generally just look like `75/153 Test   #9: bench_sanity_check ...................***Failed  770.84 sec    out of memory`
  * Places that can't use ctest (like the Windows-cross CI task) have to explicitly run it, or risk forgetting to run it.
  * All benchmarks are run sequentially, when they could run in parallel instead.

  Both issues can lead to CI timeouts and leave CPU unused during testing.

  Fix all issues by running it as part of the functional tests instead. This is similar to the rpcauth tests (https://github.com/bitcoin/bitcoin/pull/32881) and util tests [bitcoin-tx, and bitcoin-util] (https://github.com/bitcoin/bitcoin/pull/32697).

ACKs for top commit:
  achow101:
    ACK fa65bc0e79
  l0rinc:
    Tested ACK fa65bc0e79
  janb84:
    tACK fa65bc0e79
  willcl-ark:
    ACK fa65bc0e79

Tree-SHA512: d27e363b7896a7543a4ee8df41a56e58b74f07d4f296e2e5ee293fc91817d0be310e26905755fb94d44417d94fa29ad4cc5d4aa19e78d25d41bc2d9e0948c034
This commit is contained in:
Ava Chow
2026-01-05 15:47:49 -08:00
8 changed files with 79 additions and 7 deletions

View File

@@ -943,6 +943,11 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
if not self.is_bitcoin_chainstate_compiled():
raise SkipTest("bitcoin-chainstate has not been compiled")
def skip_if_no_bitcoin_bench(self):
"""Skip the running test if bench_bitcoin has not been compiled."""
if not self.is_bench_compiled():
raise SkipTest("bench_bitcoin has not been compiled")
def skip_if_no_cli(self):
"""Skip the running test if bitcoin-cli has not been compiled."""
if not self.is_cli_compiled():
@@ -976,6 +981,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
if self.options.valgrind:
raise SkipTest("This test is not compatible with Valgrind.")
def is_bench_compiled(self):
"""Checks whether bench_bitcoin was compiled."""
return self.config["components"].getboolean("BUILD_BENCH")
def is_cli_compiled(self):
"""Checks whether bitcoin-cli was compiled."""
return self.config["components"].getboolean("ENABLE_CLI")

View File

@@ -261,6 +261,10 @@ class Binaries:
# Add -nonamed because "bitcoin rpc" enables -named by default, but bitcoin-cli doesn't
return self._argv("rpc", self.paths.bitcoincli) + ["-nonamed"]
def bench_argv(self):
"Return argv array that should be used to invoke bench_bitcoin"
return self._argv("bench", self.paths.bitcoin_bench)
def tx_argv(self):
"Return argv array that should be used to invoke bitcoin-tx"
return self._argv("tx", self.paths.bitcointx)
@@ -301,6 +305,7 @@ def get_binary_paths(config):
binaries = {
"bitcoin": "BITCOIN_BIN",
"bitcoind": "BITCOIND",
"bench_bitcoin": "BITCOIN_BENCH",
"bitcoin-cli": "BITCOINCLI",
"bitcoin-util": "BITCOINUTIL",
"bitcoin-tx": "BITCOINTX",