Review report

bitcoin/bitcoin: PR #35713

3 minor findings · 1 suggestion

Earlier concerns neither republished nor resolved: 3 minor findings · 8 suggestions. See the Run archive for their assessments.

Findings

Link

[minor] · CTest does not discover suites declared with TEST_SUITE_BEGIN

A suite declared with the new macro registers with the runner but gets no CTest entry, so CTest-based CI would omit it.

Location: src/test/util/framework.h:482 (head).

Details and suggested fix

add_boost_test() in src/test/CMakeLists.txt scans raw source only for BOOST_FIXTURE_TEST_SUITE( and BOOST_AUTO_TEST_SUITE(. It creates a filtered CTest entry for each match, with no unfiltered fallback. Migrating a suite to TEST_SUITE_BEGIN therefore removes its CTest entry on the next configure, although direct invocation of test_bitcoin can still run its cases. The suite-naming lint has the same Boost-only limitation. Extend the discovery and lint patterns to recognize TEST_SUITE_BEGIN(name, with or without a fixture argument. No checked-in test uses the new spelling directly yet, so no existing suite is currently omitted.


Link

[minor] · Exception-checking macros swallow REQUIRE aborts

A failing owner-thread REQUIRE inside an exception-checked expression can let the test continue past a fatal assertion, although the case still fails.

Location: src/test/util/framework.h:610 (head).

Details and suggested fix

REQUIRE records its failure and throws framework::RequireFailed to abort the case. CHECK_THROWS catches that sentinel as a successful exception check. CHECK_NOTHROW, CHECK_THROWS_AS and CHECK_EXCEPTION, including their Boost shims, also swallow it and continue, generally recording another failure. Subsequent code can then use state the fatal assertion was meant to guard, causing misleading failures or a crash. Add catch (const ::framework::RequireFailed&) { throw; } before the ordinary exception handlers so the runner receives the abort. CHECK_THROWS has no callers, and the inspected Boost no-throw callees do not use REQUIRE, so no current triggering caller was identified.


Link

[minor] · Malformed BOOST_TEST_RANDOM values are accepted or silently ignored

A mistyped seed can select its numeric prefix or disable test-order shuffling without an invalid-input diagnostic.

Location: src/test/util/framework.cpp:375 (head).

Details and suggested fix

parse_shuffle_seed() does not check that result.ptr reached the end, so 123junk selects seed 123 and 1junk requests OS entropy. Non-numeric or overflowing values return nullopt, just like unset or 0, leaving the registry order unchanged without a seed diagnostic. Accepted seeds are logged when shuffling occurs. Require full-string consumption and distinguish invalid input from disabled shuffling, then fail with a diagnostic for invalid values. CI defaults to 1, and no in-repository producer of malformed values was found, so this affects mistyped manual or CI overrides.


Optional improvements

Link

[suggestion] · Mixed-sign CHECK comparisons use undocumented mathematical-value semantics

CHECK and the comparison shims can disagree with the written C++ expression and with BOOST_CHECK when comparing negative signed and unsigned integers.

Location: src/test/util/framework.h:345 (head).

Details and suggested fix

For the supported integral types, decomposition calls std::cmp_equal, std::cmp_less, etc. instead of applying the usual C++ arithmetic conversions. Thus CHECK(-1 < 1u) passes even though the native expression is false. BOOST_TEST and the Boost comparison shims inherit this behavior, while BOOST_CHECK evaluates natively through CHECK_NO_DISPLAY. Mathematical-value comparisons avoid sign-comparison warnings, but their semantics need to be explicit: document this choice at both CHECK and DECOMPOSE_OP. No current assertion comparing a negative signed value with an unsigned operand was found.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.