Review report

bitcoin/bitcoin: PR #35713

2 minor findings · 6 suggestions

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

Findings

Link

[minor] · CTest discovery ignores suites declared with TEST_SUITE_BEGIN

A suite declared only with the new macro gets no CTest entry, so adopting it would omit that suite from CTest-based CI runs.

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

Details and suggested fix

add_boost_test() scans source text rather than the runner registry. Both CMake expressions recognize only the Boost suite spellings, so a source whose suite is declared only with TEST_SUITE_BEGIN receives no CTest registration. The standard CI unit-test path invokes ctest, while direct test_bitcoin execution still includes those cases. The suite-naming lint also ignores the new spelling. No checked-in test uses TEST_SUITE_BEGIN directly yet, so this is a migration gap rather than a currently omitted suite. Extend CMake discovery and both lint patterns to recognize TEST_SUITE_BEGIN while retaining the Boost spellings.


Link

[minor] · README's core-dump instructions no longer match the runner

The documented --catch_system_errors=no option makes the new runner exit with “Unknown argument” before executing any test.

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

Details and suggested fix

src/test/README.md:153-157 still tells developers to add the plural --catch_system_errors=no when debugging a crash. The parser accepts only singular --catch_system_error, so the documented option sets show_help and returns exit status 2 before tests run. The README also still describes Boost as the runner and says it intercepts system errors by default. The replacement installs no system-error handler, accepts singular =no as a no-op, and rejects =yes as unsupported. Update the README to describe the new runner and obtaining core dumps through the normal OS settings without a runner bypass flag. CTest already uses the accepted singular spelling and is unaffected.


Optional improvements

Link

[suggestion] · Mixed-sign CHECK comparisons differ from the written C++ operator

CHECK and the comparison shims use undocumented mathematical-value semantics, so they can disagree with Boolean BOOST_CHECK assertions for negative signed values compared with unsigned values.

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

Details and suggested fix

When both operands satisfy is_non_bool_char_int, the decomposer calls std::cmp_* instead of evaluating the written operator. For example, CHECK(-1 < 1u) passes although the built-in comparison is false. BOOST_TEST and the comparison shims inherit this behavior, while BOOST_CHECK(expr) evaluates the native Boolean expression through CHECK_NO_DISPLAY. Mathematical-value comparisons avoid sign-compare warnings and may be intentional, but the API does not document this distinction. Document these semantics at DECOMPOSE_OP and in the CHECK description. No current assertion comparing a negative signed value with an unsigned one was found, so the effect on the current suite is unconfirmed.


Link

[suggestion] · No test verifies the runner's failure exit status

Existing suites expect successful runner execution, so they do not verify that failed assertions and escaped exceptions produce a nonzero exit status.

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

Details and suggested fix

A failed REQUIRE relies on record_check counting the failure before the runner catches and ignores RequireFailed. Unexpected exceptions rely on exception_occurred(), and the final exit status relies on summary.failed. No conformance test checks these paths, so a regression could leave ordinary passing suites green. Add a separate executable linked against test_framework with cases for a failing CHECK, a failing REQUIRE followed by a sentinel statement, an escaped exception, and a failing CHECK in a joined child thread. Have a harness run each case separately and check the exit status, diagnostics, and absence of the sentinel. This keeps intentional failures out of test_bitcoin.


Link

[suggestion] · Descriptor key-count checks no longer print the compared counts

The two rewritten key-count checks retain the descriptor context but lose the mismatched numbers previously displayed by the equality assertions.

Location: src/test/descriptor_tests.cpp:298 (head).

Details and suggested fix

These checks changed from BOOST_CHECK_EQUAL with descriptor context to BOOST_CHECK_MESSAGE, which maps to CHECK_NO_DISPLAY. That path converts the comparison to bool, so failure output retains the expression and descriptor but not the compared counts. Both operands are unsigned integers that CHECK can decompose. Use CHECK(key_exprs + 1 == parse_pub->GetKeyCount(), "Pub desc: " << pub) and the equivalent CHECK with private-descriptor context for the second assertion. This preserves both the values and the context.


Link

[suggestion] · Duplicate test names share the same runner identity

Two same-named cases can register under one suite/name, so their filters and per-test labels collide.

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

Details and suggested fix

FIXTURE_TEST_CASE derives implementation namespaces from __LINE__, not the case name, and Registrar appends entries without checking uniqueness. Two same-named BOOST_AUTO_TEST_CASE declarations in a suite therefore register as the same suite/x. A matching filter selects both, and their per-test labels coincide, although assertion source locations still distinguish individual failures. With a custom -testdatadir, the fixtures also reuse the name-based datadir: after the first releases its lock, the second deletes its saved contents during setup. Reject duplicate suite/name pairs in run() before executing cases. No current duplicate is claimed; this guards against future copy-paste mistakes.


Link

[suggestion] · Boolean Boost shims print an unrelated operator<< hint

Ordinary false conditions receive advice about a missing operator<<, even though the compatibility shim never attempts to format their values.

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

Details and suggested fix

BOOST_CHECK and BOOST_CHECK_MESSAGE use CHECK_NO_DISPLAY, while BOOST_REQUIRE uses the analogous REQUIRE_NO_DISPLAY path. A false predicate selects the fixed advice about implementing << without checking whether anything is unprintable. For an assertion such as BOOST_CHECK(x.empty()), the result is a printable Boolean; the shim simply does not decompose it. Use neutral text such as “expression evaluated to false” for the compatibility shims, reserving the formatting hint for deliberate use of the no-display API. The source expression and supplied context should remain visible, and pass/fail behavior need not change.


Link

[suggestion] · current_test_full_name documents the wrong separator

The public header documents suite::case, while callers actually receive suite/case.

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

Details and suggested fix

test_name() joins a nonempty suite and case with /, and current_test_full_name() returns the stored name unchanged. src/test/main.cpp already documents this as suite/case. Change the header comment to the same format so the API documentation matches the returned value.


Coverage details

Earlier concerns

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