test: Fix broken --valgrind handling after bitcoin wrapper#34608
test: Fix broken --valgrind handling after bitcoin wrapper#34608ryanofsky merged 3 commits intobitcoin:masterfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
cc @Sjors @ryanofsky |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK faec648. Nice cleanups and fix. It seems good to keep valgrind args separate and add them right before invoking commands instead of baking them into bitcoind args.
The second commit removing the missing binaries checks added in #31462 and #32921 is probably also ok in most cases but would seem worse in the case where "only a subset of the necessary previous release binaries are available" which #31462 was intended to improve. This is not a case I normally deal with, while I do deal with the case where I have done a partial build and the check warns about a missing binary which is not actually needed. So I am ok with getting rid of the check, but maybe @theStack would be less happy.
You could try scaling back the second commit faec648 to keep the missing binaries check but only raise the error if v is not None, dropping the "did you compile" error but keeping the previous releases error.
Yeah, I guess so, but it seems an edge case. Personally, I think the single FileNotFoundError with the path to the releases folder, and the version number in the path should be enough for a dev to figure out that the specific version executable was not found, and that it may need to be fetched. The prior confusing AssertionError is long fixed on current master. But no strong opinion. Happy to push your suggestion, if another reviewer likes it.
Ah, good point that the check has not only false-negatives, but also false-positives. |
|
Concept ACK
Thanks for pinging. It's fine for me to remove the missing binaries checks, considering that the confusing error message at the time #31462 was merged has been improved on master since #31620 (i.e. the |
|
It seems that passing In comparison, running the same command with any other functional tests shows the valgrind binary, e.g. Didn't look closer yet, but I guess the |
Following might be a quick fix: --- a/test/functional/tool_bitcoin.py
+++ b/test/functional/tool_bitcoin.py
@@ -39,7 +39,7 @@ class ToolBitcoinTest(BitcoinTestFramework):
def set_cmd_args(self, node, args):
"""Set up node so it will be started through bitcoin wrapper command with specified arguments."""
- node.args = [self.binary_paths.bitcoin_bin] + args + ["node"] + self.node_options[node.index]
+ node.args = self.get_binaries().valgrind_cmd + [self.binary_paths.bitcoin_bin] + args + ["node"] + self.node_options[node.index]
def test_args(self, cmd_args, node_args, expect_exe=None, expect_error=None):
node = self.nodes[0]It would probably be good to do a little refactoring so |
Thx. I took something like this. I think it is sufficient for now, and any refactoring can be done in a follow-up. I am also happy to push any commit or diff here, if someone sends one. |
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.
The error was added in commit 1ea7e45, because there was an additional confusing `AssertionError: [node 0] Error: no RPC connection` instead of just a single `FileNotFoundError: [Errno 2] No such file or directory`. This is no longer needed on current master. Also, the test is incomplete, because it was just checking bitcoind and bitcoin-cli, not any other missing binaries. Also, after the previous commit, it would not work in combination with --valgrind. Instead of trying to make it complete, and work in all combinations, just remove it, because the already existing error will be clear in any case. This can be tested via: ```sh ./test/get_previous_releases.py mv releases releases_backup # Confirm the test is skipped due to missing releases ./bld-cmake/test/functional/wallet_migration.py # Confirm the test fails due to missing releases ./bld-cmake/test/functional/wallet_migration.py --previous-releases mv releases_backup releases mv ./releases/v28.2 ./releases/v28.2_backup # Confirm the test fails with a single FileNotFoundError ./bld-cmake/test/functional/wallet_migration.py mv ./releases/v28.2_backup ./releases/v28.2 # Confirm the test runs and passes ./bld-cmake/test/functional/wallet_migration.py rm ./bld-cmake/bin/bitcoind # Confirm the test fails with a single "No such file or directory", # testing with and without --valgrind ./bld-cmake/test/functional/wallet_migration.py ./bld-cmake/test/functional/wallet_migration.py --valgrind ```
fa4c950 to
fa5d478
Compare
|
ACK fa5d478 |
|
Backported to 30.x in #34459. |
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.
Github-Pull: bitcoin#34608
Rebased-From: fa03fbf
The error was added in commit 1ea7e45, because there was an additional confusing `AssertionError: [node 0] Error: no RPC connection` instead of just a single `FileNotFoundError: [Errno 2] No such file or directory`. This is no longer needed on current master. Also, the test is incomplete, because it was just checking bitcoind and bitcoin-cli, not any other missing binaries. Also, after the previous commit, it would not work in combination with --valgrind. Instead of trying to make it complete, and work in all combinations, just remove it, because the already existing error will be clear in any case. This can be tested via: ```sh ./test/get_previous_releases.py mv releases releases_backup # Confirm the test is skipped due to missing releases ./bld-cmake/test/functional/wallet_migration.py # Confirm the test fails due to missing releases ./bld-cmake/test/functional/wallet_migration.py --previous-releases mv releases_backup releases mv ./releases/v28.2 ./releases/v28.2_backup # Confirm the test fails with a single FileNotFoundError ./bld-cmake/test/functional/wallet_migration.py mv ./releases/v28.2_backup ./releases/v28.2 # Confirm the test runs and passes ./bld-cmake/test/functional/wallet_migration.py rm ./bld-cmake/bin/bitcoind # Confirm the test fails with a single "No such file or directory", # testing with and without --valgrind ./bld-cmake/test/functional/wallet_migration.py ./bld-cmake/test/functional/wallet_migration.py --valgrind ``` Github-Pull: bitcoin#34608 Rebased-From: fa29fb7
Github-Pull: bitcoin#34608 Rebased-From: fa5d478
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.
Github-Pull: bitcoin#34608
Rebased-From: fa03fbf
The error was added in commit 1ea7e45, because there was an additional confusing `AssertionError: [node 0] Error: no RPC connection` instead of just a single `FileNotFoundError: [Errno 2] No such file or directory`. This is no longer needed on current master. Also, the test is incomplete, because it was just checking bitcoind and bitcoin-cli, not any other missing binaries. Also, after the previous commit, it would not work in combination with --valgrind. Instead of trying to make it complete, and work in all combinations, just remove it, because the already existing error will be clear in any case. This can be tested via: ```sh ./test/get_previous_releases.py mv releases releases_backup # Confirm the test is skipped due to missing releases ./bld-cmake/test/functional/wallet_migration.py # Confirm the test fails due to missing releases ./bld-cmake/test/functional/wallet_migration.py --previous-releases mv releases_backup releases mv ./releases/v28.2 ./releases/v28.2_backup # Confirm the test fails with a single FileNotFoundError ./bld-cmake/test/functional/wallet_migration.py mv ./releases/v28.2_backup ./releases/v28.2 # Confirm the test runs and passes ./bld-cmake/test/functional/wallet_migration.py rm ./bld-cmake/bin/bitcoind # Confirm the test fails with a single "No such file or directory", # testing with and without --valgrind ./bld-cmake/test/functional/wallet_migration.py ./bld-cmake/test/functional/wallet_migration.py --valgrind ``` Github-Pull: bitcoin#34608 Rebased-From: fa29fb7
Github-Pull: bitcoin#34608 Rebased-From: fa5d478
fdaf656 doc: update release notes for v30.x (fanquake) 0202ae3 doc: Update Guix install for Debian/Ubuntu (MarcoFalke) 2d035b1 guix: use a temporary file over sponge (fanquake) dca7700 test: valgrind --trace-children=yes for bitcoin wrapper (MarcoFalke) dd89249 test: Remove redundant warning about missing binaries (MarcoFalke) 6993b1b test: Fix broken --valgrind handling after bitcoin wrapper (MarcoFalke) d54d7df wallet: rpc: manpage: fix example missing `fee_rate` argument (SomberNight) 412725b net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures (ANAVHEOBA) 85f8d28 build: avoid exporting secp256k1 symbols (Cory Fields) b7a182c doc: fix broken bpftrace installation link (jayvaliya) 1a757af ci: Print verbose build error message in test-each-commit (MarcoFalke) f5d4dc9 ci: [refactor] Allow overwriting check option in run helper (MarcoFalke) 7317a0b ci: Always print low ccache hit rate notice (MarcoFalke) 0a768d4 fuzz: Use `__AFL_SHM_ID` for naming test directories (marcofleon) 48749cf miniscript: correct and_v() properties (Antoine Poinsot) 19b3e2e test: use ModuleNotFoundError in interface_ipc.py (fanquake) Pull request description: Backports: * #34409 * #34434 * #34445 * #34453 * #34461 * #34510 * #34549 * #34554 * #34561 * #34608 * #34627 * #34671 ACKs for top commit: willcl-ark: ACK fdaf656 marcofleon: lgtm ACK fdaf656 Tree-SHA512: dc0ca9a6298519e1dc69d37985f82d87765b6857b491285e3ff77eac5870bf72c662f18ab90b35d3df595dc75f9b0762299259e53588efb7f4994797fdd07213
Currently, tool_bitcoin.py is failing under
--valgrind:Fix this issue by running
bitcoinunder valgrind.