mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-23 04:16:52 +02:00
test: Fix broken --valgrind handling after bitcoin wrapper
Prior to this commit, tool_bitcoin.py was failing:
```sh
$ ./bld-cmake/test/functional/tool_bitcoin.py --valgrind
TestFramework (ERROR): Unexpected exception
Traceback (most recent call last):
File "./test/functional/test_framework/test_framework.py", line 138, in main
self.setup()
~~~~~~~~~~^^
File "./test/functional/test_framework/test_framework.py", line 269, in setup
self.setup_network()
~~~~~~~~~~~~~~~~~~^^
File "./test/functional/tool_bitcoin.py", line 38, in setup_network
assert all(node.args[:len(node_argv)] == node_argv for node in self.nodes)
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
```
This commit fixes this issue by running `bitcoin` under valgrind. Also,
it comes with other improvements:
* Drop the outdated valgrind 3.14 requirement, because there is no
distro that ships a version that old anymore.
* Drop the VALGRIND_SUPPRESSIONS_FILE env var handling, because it was
presumably never used since it was introduced. Also, the use-case
seems limited.
Review note:
The set_cmd_args was ignoring the --valgrind test option.
In theory, this could be fixed by refactoring Binaries::node_argv() to
be used here. However, for now, just re-implement the node_argv logic in
set_cmd_args to prepend the valgrind cmd.
This commit is contained in:
@@ -91,7 +91,27 @@ class TestNode():
|
||||
To make things easier for the test writer, any unrecognised messages will
|
||||
be dispatched to the RPC connection."""
|
||||
|
||||
def __init__(self, i, datadir_path, *, chain, rpchost, timewait, timeout_factor, binaries, coverage_dir, cwd, extra_conf=None, extra_args=None, use_cli=False, start_perf=False, use_valgrind=False, version=None, v2transport=False, uses_wallet=False, ipcbind=False):
|
||||
def __init__(
|
||||
self,
|
||||
i,
|
||||
datadir_path,
|
||||
*,
|
||||
chain,
|
||||
rpchost,
|
||||
timewait,
|
||||
timeout_factor,
|
||||
binaries,
|
||||
coverage_dir,
|
||||
cwd,
|
||||
extra_conf=None,
|
||||
extra_args=None,
|
||||
use_cli=False,
|
||||
start_perf=False,
|
||||
version=None,
|
||||
v2transport=False,
|
||||
uses_wallet=False,
|
||||
ipcbind=False,
|
||||
):
|
||||
"""
|
||||
Kwargs:
|
||||
start_perf (bool): If True, begin profiling the node with `perf` as soon as
|
||||
@@ -147,15 +167,6 @@ class TestNode():
|
||||
self.ipc_socket_path = self.ipc_tmp_dir / "node.sock"
|
||||
self.args.append(f"-ipcbind=unix:{self.ipc_socket_path}")
|
||||
|
||||
# Use valgrind, expect for previous release binaries
|
||||
if use_valgrind and version is None:
|
||||
default_suppressions_file = Path(__file__).parents[3] / "contrib" / "valgrind.supp"
|
||||
suppressions_file = os.getenv("VALGRIND_SUPPRESSIONS_FILE",
|
||||
default_suppressions_file)
|
||||
self.args = ["valgrind", "--suppressions={}".format(suppressions_file),
|
||||
"--gen-suppressions=all", "--exit-on-first-error=yes",
|
||||
"--error-exitcode=1", "--quiet"] + self.args
|
||||
|
||||
if self.version_is_at_least(190000):
|
||||
self.args.append("-logthreadnames")
|
||||
if self.version_is_at_least(219900):
|
||||
|
||||
Reference in New Issue
Block a user