test: run bitcoin-cli -ipcconnect check under valgrind with -datadir

This case invoked bitcoin-cli via raw subprocess.run() without the
valgrind wrapper (bypassing valgrind) and without -datadir (so it read
the default datadir's bitcoin.conf, e.g. ~/.bitcoin, and failed whenever
that real config was unusable). Build the command like the rest of the
framework: prepend binaries.valgrind_cmd and pass the node's -datadir so
the check runs under valgrind and depends only on the build's IPC
support, not the host environment.
This commit is contained in:
Michael Dietz
2026-06-02 09:28:46 -05:00
parent fbe628756c
commit 7735c13488

View File

@@ -458,7 +458,8 @@ class TestBitcoinCli(BitcoinTestFramework):
# This tests behavior when ENABLE_IPC is off. When it is on,
# 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")
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)
assert_equal(result.stdout, "error: bitcoin-cli was not built with IPC support\n")
assert_equal(result.stderr, None)