Skip to content

Commit 0c1ade6

Browse files
committed
Skip rpcbind_test if OS/network requirements are not met.
1 parent 232b666 commit 0c1ade6

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

test/functional/rpcbind_test.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test running bitcoind with the -rpcbind and -rpcallowip options."""
66

7+
import socket
8+
import sys
9+
710
from test_framework.test_framework import BitcoinTestFramework
811
from test_framework.util import *
912
from test_framework.netutil import *
@@ -52,15 +55,26 @@ def run_allowip_test(self, allow_ips, rpchost, rpcport):
5255

5356
def run_test(self):
5457
# due to OS-specific network stats queries, this test works only on Linux
55-
assert(sys.platform.startswith('linux'))
58+
if not sys.platform.startswith('linux'):
59+
self.log.warning("This test can only be run on linux. Skipping test.")
60+
sys.exit(self.TEST_EXIT_SKIPPED)
5661
# find the first non-loopback interface for testing
5762
non_loopback_ip = None
5863
for name,ip in all_interfaces():
5964
if ip != '127.0.0.1':
6065
non_loopback_ip = ip
6166
break
6267
if non_loopback_ip is None:
63-
assert(not 'This test requires at least one non-loopback IPv4 interface')
68+
self.log.warning("This test requires at least one non-loopback IPv4 interface. Skipping test.")
69+
sys.exit(self.TEST_EXIT_SKIPPED)
70+
try:
71+
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
72+
s.connect(("::1",1))
73+
s.close
74+
except OSError:
75+
self.log.warning("This test requires IPv6 support. Skipping test.")
76+
sys.exit(self.TEST_EXIT_SKIPPED)
77+
6478
self.log.info("Using interface %s for testing" % non_loopback_ip)
6579

6680
defaultport = rpc_port(0)

test/functional/test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
248248
job_queue = TestHandler(jobs, tests_dir, test_list, flags)
249249

250250
max_len_name = len(max(test_list, key=len))
251-
results = BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "PASSED ", "DURATION") + BOLD[0]
251+
results = BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "STATUS ", "DURATION") + BOLD[0]
252252
for _ in range(len(test_list)):
253253
(name, stdout, stderr, status, duration) = job_queue.get_next()
254254
all_passed = all_passed and status != "Failed"

0 commit comments

Comments
 (0)