bitcoin wrapper: respect CMAKE_INSTALL_BINDIR/LIBEXECDIR

bitcoin/bitcoin: PR #36106

1 minor finding · 3 suggestions

Findings

Link

[minor] · Equal install directories make the installed-layout test raise ValueError

Source inspection shows that equal bindir and libexecdir destinations make the new functional test raise ValueError; no repository CI configuration using that setting was found.

Location: test/functional/tool_bitcoin.py:141 (head).

Details and suggested fix

With -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_LIBEXECDIR=bin, os.path.relpath() returns '.'. The positive fixture puts bitcoind beside the wrapper and can succeed, but Path('.').name is empty, so the subsequent with_name('_notfound') raises ValueError. CMake accepts equal destinations and explicitly handles their empty relative path. Handle libexecdir == Path('.') before constructing the negative fixture, for example by skipping that case and documenting that the positive case cannot distinguish configured-directory lookup from sibling fallback.


Optional improvements

Link

[suggestion] · Default-layout coverage does not distinguish the fix from hardcoded lookup

With default install directories, source inspection shows both new assertions would pass with the old hardcoded lookup; no repository CI configuration sets a non-default CMAKE_INSTALL_LIBEXECDIR.

Location: test/functional/tool_bitcoin.py:137 (head).

Details and suggested fix

For bin and libexec, the positive fixture places bitcoind at <prefix>/found/sub/libexec, exactly where the base wrapper searches. The negative fixture uses ../libexec_notfound, so it also produces the expected failure on base. Characterizing that behavior in the first commit is useful, but these default settings would not catch a regression back to hardcoded libexec. Configure one CI job that runs this functional test with -DCMAKE_INSTALL_LIBEXECDIR=lib; the positive fixture would then require the configured lookup used to fix #35785.


Link

[suggestion] · Installed-layout assertions hide stderr and accept unrelated negative failures

The positive assertion omits captured error output, while the negative assertion accepts any nonzero exit without checking the expected lookup-failure diagnostic.

Location: test/functional/tool_bitcoin.py:138 (head).

Details and suggested fix

assert_equal(result.returncode, 0) reports only the integers, so a failure loses the wrapper or valgrind explanation captured in stderr. The negative check also omits stderr and would accept a signal termination confined to the missing-target path, even though the positive case catches failures common to both invocations. Include stdout and stderr in assertion failures, following test_args() above, and assert that the negative stderr contains the expected execvp failed to execute diagnostic.


Link

[suggestion] · Installed-layout subprocess ignores the timeout factor

The fixed 60-second timeout ignores --timeout-factor, including the default factor of four under valgrind; no timeout failure has been observed.

Location: test/functional/tool_bitcoin.py:134 (head).

Details and suggested fix

run_wrapper() launches valgrind with child tracing when requested, but passes a literal timeout=60 directly to subprocess.run(). This prevents slow-runner timeout adjustments from extending either installed-layout invocation. Use timeout=60 * self.options.timeout_factor. The command only prints version information, so the current limit will usually suffice; the existing unscaled get_node_output() wait is a separate instance of the same pattern.


Coverage details