#36022 test: add coverage for bitcoin wrapper argument handling

full analysis

https://github.com/bitcoin/bitcoin/pull/36022 · cyb3ralbert · +51/-0 in 1 files, 2 commits · labels: Tests

Goal

  • Verify command-line argument parsing and error handling in the bitcoin CLI wrapper
  • Prevents regressions when users request help or version information or pass invalid options

Adds test coverage for the `bitcoin` CLI wrapper argument parsing in `test/functional/tool_bitcoin.py`. It tests `--version`, `--help`, execution without arguments, and unrecognized commands/options, which previously returned without calling `exec` and were not covered by tests.

Problem: The `bitcoin` wrapper executable had zero test coverage for paths that return before executing a child process, leaving CLI argument parsing and error handling unverified.

Category: Tools and scripts (#10 of 22)

P3 · test coverage

  • P3 because it exercises untested argument parsing and early exit paths in the wrapper tool
  • Raises test coverage for the wrapper from zero to nearly half without affecting core consensus

P3 because it exercises untested argument parsing and exit paths in the `bitcoin` wrapper, bringing test coverage of `src/bitcoin.cpp` from 0% to 47.1%.

Membership: Tests the CLI behavior and argument parsing of the `bitcoin` wrapper binary under contrib/src.

Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 1

Reviewability: Ready

  • Ready for review with all CI checks passing and previous feedback addressed

The code is clean, CI passes, and the only reviewer suggestion has been addressed.

Author status: active; addressed review feedback on 2026-08-24

Resolved concerns:

  • mercie-ux noted that `run_wrapper` bypassed `valgrind_cmd`, leaving the new tests uninstrumented under `--valgrind`; the author updated the helper to include `valgrind_cmd`

Agreement: Positive

  • Constructive feedback on instrumenting tests under Valgrind addressed by the author (mercie-ux)
  • No open objections or unresolved concerns

Positive: mercie-ux suggested running under valgrind_cmd, which the author implemented

One reviewer provided constructive feedback on Valgrind test execution, which the author incorporated with local benchmark verification; there are no objections.

  • mercie-ux suggested using `node.binaries.valgrind_cmd` prefix so wrapper tests run under Valgrind
  • cyb3ralbert adopted the suggestion and verified execution timing

Review verdicts (DrahtBot): 0

Files

51 lines under test/bench/ci.

  • test/functional/tool_bitcoin.py +51/-0

Card

Adds functional tests for the bitcoin wrapper binary's argument handling, covering --version, --help, invocation without commands, and invalid options. Previously, src/bitcoin.cpp had no coverage in the functional test suite for non-exec exit paths. mercie-ux reviewed and suggested valgrind integration, which the author implemented. The PR is ready for review with no blockers.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T15:56, confidence high, input hash a9df184f4ddeef94