Merge bitcoin/bitcoin#35431: test: pass -datadir to bitcoin-cli -ipcconnect check

7735c13488 test: run bitcoin-cli -ipcconnect check under valgrind with -datadir (Michael Dietz)

Pull request description:

  This case invokes bitcoin-cli via raw subprocess.run() without -datadir, so it reads the default datadir's bitcoin.conf (e.g. ~/.bitcoin) and fails whenever that real config is unusable. Pass the node's -datadir so the check reads the test's own bitcoin.conf and depends only on the build's IPC support, not the host environment.

ACKs for top commit:
  maflcko:
    lgtm ACK 7735c13488
  sedited:
    ACK 7735c13488

Tree-SHA512: 5264433e2cd1747b9b9b4437b80f1849b5fa01620dd958c34c124925270dfca85c3809186285bf1dd70a8358552e1ebb589ec84093e11bb0d66cfe10f04dde81
This commit is contained in:
merge-script
2026-06-04 11:04:40 +02:00

View File

@@ -458,7 +458,8 @@ class TestBitcoinCli(BitcoinTestFramework):
# This tests behavior when ENABLE_IPC is off. When it is on, # This tests behavior when ENABLE_IPC is off. When it is on,
# behavior is checked by the interface_ipc_cli.py test. # behavior is checked by the interface_ipc_cli.py test.
self.log.info("Test bitcoin-cli -ipcconnect triggers error if not built with IPC support") self.log.info("Test bitcoin-cli -ipcconnect triggers error if not built with IPC support")
args = [self.binary_paths.bitcoincli, "-ipcconnect=unix", "-getinfo"] # node.cli.options includes -rpcconnect which can't be combined with -ipcconnect, so pass just -datadir directly to keep bitcoin-cli on the test's bitcoin.conf
args = self.nodes[0].binaries.valgrind_cmd + [self.nodes[0].binaries.paths.bitcoincli, f"-datadir={self.nodes[0].datadir_path}", "-ipcconnect=unix", "-getinfo"]
result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
assert_equal(result.stdout, "error: bitcoin-cli was not built with IPC support\n") assert_equal(result.stdout, "error: bitcoin-cli was not built with IPC support\n")
assert_equal(result.stderr, None) assert_equal(result.stderr, None)