mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-13 15:33:51 +02:00
1950da94fctest: enable `rpc_bind` on macOS and BSD (Lőrinc)7236a05503test: enable `feature_bind_extra` on macOS and BSD (Lőrinc) Pull request description: ### Problem Some functional tests are shown as skipped when running on macOS & BSD because `test_framework/netutil.py` only implemented the Linux-specific logic for checking which TCP sockets a node is listening on. ### Fix Add macOS and BSD implementations in `test/functional/test_framework/netutil.py` so tests can query: * which TCP sockets a node is listening on (`get_bind_addrs()`, via `lsof`) * a non-loopback interface address (`all_interfaces()`, via `ifconfig`) Then enable the previously Linux-only tests by switching to a shared POSIX platform guard. ### Commands <details> <summary><code>get_bind_addrs()</code> (<code>lsof</code> + regex)</summary> > Command used ```bash lsof -nP -a -p <pid> -iTCP -sTCP:LISTEN -Ftn ``` > Flags - -D: device cache warnings - -n: no hostname resolution - -P: no service/port-name resolution - -a: AND all conditions - -p <pid>: filter by process ID - -iTCP: TCP sockets only - -sTCP:LISTEN: listening sockets only - -Ftn: machine-readable output (fields: type `t`, name `n`) > Regex parser ```regex t(IPv[46])\nn(\*|\[.+?]|[^:]+):(\d+) ``` > Captured groups - group 1: IPv4 / IPv6 (used to disambiguate `*`) - group 2: host (`*`, `[::1]`, `127.0.0.1`, ...) - group 3: port </details> <details> <summary><code>all_interfaces()</code> (<code>ifconfig</code> + regex)</summary> > Command used ```bash ifconfig -au ``` > Regex parsing Interface blocks: ```regex (?m)^(?P<iface>\S+):(?P<block>[^\n]*(?:\n[ \t]+[^\n]*)*) ``` IPv4 extraction within each block: ```regex inet (\S+) ``` </details> ### Notes The only remaining platform skips on macOS are the USDT/BPF tracing tests (`interface_usdt_*.py`). ACKs for top commit: Sjors: ACK1950da94fcachow101: ACK1950da94fcwillcl-ark: tACK1950da94fcTree-SHA512: 4cecc88852623f3fe3a7dccceb0e71932824c1ed7f1d4ab89b953ff6b7991afbd0b016c819c17e966bed53082dd623a832752b8847711861009cd5ffc4677367