qa: Add `skip_if_no_lsof_on_nonlinux` helper and use it where needed
What changed, and why it matters
This is a harmless test-suite maintenance change. It adds a helper that skips certain Bitcoin Core functional tests on non-Linux systems when the 'lsof' tool is missing. It does not change the actual Bitcoin node software, network rules, wallet handling, or any code that processes untrusted data.
No security action needed. This is a normal QA/test-infrastructure improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit introduces skip_if_no_lsof_on_nonlinux() in the test framework and calls it from feature_bind_extra.py and rpc_bind.py. On non-Linux POSIX platforms without lsof, the affected tests are skipped rather than failing. No production code, consensus logic, RPC handlers, or networking implementation is modified.
Changed components
test/functional/feature_bind_extra.pytest/functional/rpc_bind.pytest/functional/test_framework/test_framework.pyInspect captured patch +7 / −0
diff --git a/test/functional/feature_bind_extra.py b/test/functional/feature_bind_extra.py
index 91f846d6..2b81e921 100755
--- a/test/functional/feature_bind_extra.py
+++ b/test/functional/feature_bind_extra.py
@@ -33,6 +33,7 @@ class BindExtraTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_platform_not_posix()
+ self.skip_if_no_lsof_on_nonlinux()
def setup_network(self):
loopback_ipv4 = addr_to_hex("127.0.0.1")
diff --git a/test/functional/rpc_bind.py b/test/functional/rpc_bind.py
index 517df5d9..3caf23dd 100755
--- a/test/functional/rpc_bind.py
+++ b/test/functional/rpc_bind.py
@@ -17,6 +17,7 @@ class RPCBindTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_platform_not_posix()
+ self.skip_if_no_lsof_on_nonlinux()
def setup_network(self):
self.add_nodes(self.num_nodes, None)
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 64dcbfd7..a145614b 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -1027,6 +1027,11 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
if platform.system() != "Linux":
raise SkipTest("not on a Linux system")
+ def skip_if_no_lsof_on_nonlinux(self):
+ """Skip the running test if the lsof utility is not available on non-Linux platforms."""
+ if sys.platform != "linux" and shutil.which("lsof") is None:
+ raise SkipTest("lsof not available")
+
def skip_if_platform_not_posix(self):
"""Skip the running test if we are not on a POSIX platform"""
if os.name != 'posix':
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.