Skip to content

Commit 83bb414

Browse files
committed
test: less ambiguous error if bitcoind is missing
Before this change, when a functional test is run without building the source, the error message suggested that previous release binaries were missing. When no previous release version is set, make the error message more specifically about bitcoind.
1 parent a8bff38 commit 83bb414

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -545,18 +545,23 @@ def bin_dir_from_version(version):
545545
extra_args[i] = extra_args[i] + ["-whitelist=noban,in,[email protected]"]
546546
if versions is None:
547547
versions = [None] * num_nodes
548-
bin_dirs = [bin_dir_from_version(v) for v in versions]
549-
# Fail test if any of the needed release binaries is missing
550-
bins_missing = False
551-
for bin_path in (argv[0] for bin_dir in bin_dirs
552-
for binaries in (self.get_binaries(bin_dir),)
553-
for argv in (binaries.node_argv(), binaries.rpc_argv())):
554-
if shutil.which(bin_path) is None:
555-
self.log.error(f"Binary not found: {bin_path}")
556-
bins_missing = True
557-
if bins_missing:
558-
raise AssertionError("At least one release binary is missing. "
559-
"Previous releases binaries can be downloaded via `test/get_previous_releases.py`.")
548+
bin_dirs = []
549+
for v in versions:
550+
bin_dir = bin_dir_from_version(v)
551+
552+
# Fail test if any of the needed release binaries is missing
553+
for bin_path in (argv[0] for binaries in (self.get_binaries(bin_dir),)
554+
for argv in (binaries.node_argv(), binaries.rpc_argv())):
555+
556+
if shutil.which(bin_path) is None:
557+
self.log.error(f"Binary not found: {bin_path}")
558+
if v is None:
559+
raise AssertionError("At least one binary is missing, did you compile?")
560+
raise AssertionError("At least one release binary is missing. "
561+
"Previous releases binaries can be downloaded via `test/get_previous_releases.py`.")
562+
563+
bin_dirs.append(bin_dir)
564+
560565
assert_equal(len(extra_confs), num_nodes)
561566
assert_equal(len(extra_args), num_nodes)
562567
assert_equal(len(versions), num_nodes)

0 commit comments

Comments
 (0)