#36190 test: Check bitcoin wrapper child exit status on windows

ReviewabilityReviewsAgreementSize
#36190 Bortlesboat test: Check bitcoin wrapper child exit status on windowsReview #36105 first0 (+2)Strong15 + 55 tests
  • Verify that the Windows wrapper correctly forwards child exit statuses and reports spawn failures
  • Prevent regressions where child exit code -1 is conflated with process launch errors
  • Review #36105 first
  • The PR branch is stacked on open PR #36105 and includes its prerequisite commits
  • Strong support with no open objections
  • Verified by testing on Linux and Windows runners across both CRTs (cyb3ralbert)
  • Finds the new tests well written and useful additions to test coverage (ryanofsky)
  • 15 lines added or modified outside tests
  • 55 lines added or modified in tests
  • 20 lines removed in total
  • 7 files, 5 commits
IPC / multiprocess#17 of 18
P3 · test coverage
  • P3 because it adds Windows functional test coverage for child process exit status propagation
  • Catches regressions where child exit code -1 is confused with spawn errors
Tools and scripts#12 of 16
P3 · test coverage
  • P3 because it validates CLI wrapper error reporting and exit code forwarding on Windows
  • Ensures wrapper exit codes 0, 1, and -1 are preserved and launch errors emit stderr messages
Utilities (logging, arguments, libraries)#53 of 59
P3 · test coverage
  • P3 because it tests Windows child process execution utilities against edge cases
  • Validates that process execution properly distinguishes spawn failures from child exit states
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Adds functional tests to tool_bitcoin.py to verify that the Windows bitcoin wrapper preserves child process exit status and reports errors on spawn failure. Specifically, it tests that exit codes 0, 1, and -1 are properly passed through by using cmd.exe as a mock child executable, and confirms that startup errors produce an exit code of 1 with an error message on stderr.

Problem: Without dedicated test coverage on Windows, regressions in process execution and exit-code forwarding in the bitcoin wrapper can go unnoticed, such as conflating child exit status -1 with process spawn errors under the Windows CRT.

Evidence of importance:

  • PR description: 'The case worth covering is exit code -1. The first version of the wrapper used _spawnvp(_P_WAIT), which returns -1 both when the spawn fails and when the child started fine and exited with -1, so bitcoin.exe reported a startup error and exited 1 instead of passing -1 through.'
  • Commit 7395505c2f: 'This detects a bug that was present in the original implementation of the earlier commit "Fix ExecVp on Windows to wait for child process"'

Scope: The PR branch currently includes the prerequisite commits from #36105; the unique changes belonging to this PR are the new test cases added to test/functional/tool_bitcoin.py.

Risk of a mistake: low (tests). A mistake in the new tests would only cause functional test failures on Windows environments and does not impact node runtime logic.

Changed since the previous assessment: Rebased on updated commits from #36105 with no functional changes to the tests.

Reviewability

Ready · Review #36105 first

Stacked on #36105; the base PR's changes are included in this diff.

Waiting on (from the thread read):

Agreement

Strong

substantive support, no open objection (cyb3ralbert, ryanofsky)

Thread notes: ryanofsky reviewed and ACKed the test commits, and converted the PR to draft status pending #36105.

Objections, suggestions, and questions:

ReviewerTypeHarm, request, or questionStatusMust beAuthor repliedQuote
cyb3ralbert (contributor)objection, correctnessa failed spawn is not tested to ensure the wrapper reports an error rather than forwarding an exit statusfixed · fix pushed · v1, not yet re-checkedansweredno2026-09-11: 'The test covers one side of that — a child exiting with `-1` is forwarded — but not the other: a failed spawn must still be reported as a wrapper error rather than forwarded as a child status.'
Status from: 2026-09-13: cyb3ralbert: 'ACK f2a1beb29873643ad382deb5d1848bd8572f4105'

Support:

  • cyb3ralbert (contributor) (ACK, 2026-09-13) [tested: tool_bitcoin.py]: Ran tool_bitcoin.py against this head on Linux and on a windows-2022 runner with cross-built binaries (both CRTs), confirming all tests pass and the new launch failure test is reached in each.
  • ryanofsky (member) (ACK, 2026-09-23) [read: last 2 commits]: Both tests are well written and add useful coverage.

Participants:

  • ryanofsky (member, support, 5 statements 2026-09-09 to 2026-09-23): ACKed the test commits and converted the PR to draft pending #36105
  • cyb3ralbert (contributor, support, 2 statements 2026-09-11 to 2026-09-13): tested on Linux and Windows, suggested adding coverage for failed child launches, and ACKed the updated PR

Dependencies

Depends on: #36105

Based on (shares commits with): #36105

Files

73 lines under test/bench/ci.

  • test/functional/tool_bitcoin.py +41/-10
  • test/functional/interface_gui.py +6/-7
  • src/util/exec.cpp +11/-1
  • src/bitcoin.cpp +4/-1
  • src/qt/test/CMakeLists.txt +3/-1
  • test/functional/test_framework/test_framework.py +4/-0
  • test/config.ini.in +1/-0

Card

The short text the ranking pass compares across PRs.

This PR adds functional tests in tool_bitcoin.py to verify that the Windows bitcoin wrapper process correctly preserves child exit statuses and reports launch failures. It tests that exit codes 0, 1, and -1 are forwarded intact without injecting unexpected stderr output, and verifies that failure to start the child process returns an exit code of 1 with an informative execvp error. The tests specifically guard against a bug in Windows CRT process handling where an exit code of -1 was conflated with process spawn failure. It depends on runtime fixes in #36105.

Data

dossier JSON · extract JSON · model ledger, generated 2026-09-27T01:22, confidence high, input hash 8758593db119fcb5
thread read through 2026-09-23 (8 statements), head 190d2350e0
Discussion read under schema 1 rules: suggestions and questions may be missing, and an objection may combine several harms (schema history).
labels: Utils/log/libs · draft

Categories

IPC / multiprocess

P3 · test coverage

Adds Windows functional test coverage for child exit status propagation in the bitcoin wrapper. As noted in the description, this 'detects a bug that was present in the original implementation' where child exit code -1 was conflated with spawn failures under the Windows CRT.

Membership: Tests process execution and exit status preservation for the bitcoin wrapper executable, which is explicitly covered under IPC.

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

Tools and scripts

P3 · test coverage

Verifies exit code forwarding and error handling for the bitcoin CLI wrapper on Windows. Citing the PR description, it ensures exit codes 0, 1, and -1 are preserved and verifies that spawn errors return exit code 1 with diagnostic output on stderr.

Membership: Directly tests the bitcoin wrapper CLI tool in test/functional/tool_bitcoin.py.

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

Utilities (logging, arguments, libraries)

P3 · test coverage

Provides test coverage for the process execution utility handling on Windows. The description highlights covering an edge case where spawn failure and exit code -1 were previously conflated.

Membership: Carries the Utils/log/libs maintainer label and validates Windows child process execution utilities (ExecVp).

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