Repository navigation
net: build the test suite on macOS - #1184
Conversation
tests/i2p_sam.rs calls libc under cfg(unix), but libc was only a Linux dependency. Add it as a cfg(unix) dev-dependency so the RST path still runs on macOS. snapshot_omits_peer_after_tcp_fin needs POLLRDHUP, which only Linux has. Off Linux tcp_has_peer_fin always returns false, so gate the test to Linux. Fixes reardencode#1179 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The |
There was a problem hiding this comment.
Verdict
APPROVE. I would merge this as-is.
The change makes rbitcoin-net's integration suite compile on non-Linux Unix. Production code is unchanged. The Linux unread-FIN test still runs. libc is the existing workspace crate, dev-only, at the same 0.2 requirement, and Cargo.lock stays put.
Findings
Pre-existing, not blocking
tcp_has_peer_fin is Linux-only and returns false on every other OS. LivePeer::tcp_fin then peeks one byte. A graceful FIN that still has unread data comes back as Ok(1), so PeerHub::snapshot keeps a handshake-complete peer. That is the case snapshot_omits_peer_after_tcp_fin pins, and it is the getpeerinfo drop Core's disconnect_nodes 5s window depends on. Darwin is a shipped target and has no POLLRDHUP. kqueue EVFILT_READ with EV_EOF can observe this; this PR does not add that.
The new #[cfg(target_os = "linux")] matches the production cfg, so the test still runs on every platform where the current implementation can pass. Empty-buffer FIN stays covered on every OS by snapshot_hides_fin_completed_keeps_connecting. Peek still treats Ok(0) as FIN, and any error other than WouldBlock or Interrupted (including reset) as a dead socket.
Nits
None.
What was built and tested
Head 97d94bb0c2deeeaeed83b8fc0fcf340366860d13, merge-base 8e62e4ce4d60c30abc851cb0893e4b80149ac9e4 (origin/master). Diff is crates/rbitcoin-net/Cargo.toml (+4) and crates/rbitcoin-net/tests/peer/mod.rs (+2).
Supply chain: libc = "0.2" matches rbitcoin-store, rbitcoin-node (cfg(unix)), and rbitcoin-ibd. No features added. Lock stays libc 0.2.191. cargo tree --locked direct edges: Darwin has dev libc 0.2.191; Windows has no direct libc; Linux has both the normal edge and the dev edge, both 0.2.191. --locked resolution succeeded.
cargo fmt --all -- --check: passcargo test --locked -p rbitcoin-net --test suite -- --quiet: 637 passed, 0 failed, 16.18s (includessnapshot_omits_peer_after_tcp_finand thei2p_samtests)snapshot_hides_fin_completed_keeps_connecting: passcargo clippy --locked -p rbitcoin-net --all-targets -- -D warnings: pass
This box is Linux. cargo check --target aarch64-apple-darwin did not get a typecheck: secp256k1-sys failed in-environment because the host cc has no macOS SDK. The Darwin libc edge above is from cargo tree, not from a Darwin rustc run. The author's macOS report (suite 635/636, one tip_accept::two_full_senders_both_enqueue flake) did not show up in this Linux full-suite run.
The required macos CI job still runs scripts/ci-os-smoke.sh only, so it will not compile this suite. That matches #1179 and is unchanged.
Fixes #1179.
The net test suite did not compile on macOS.
tests/i2p_sam.rsuseslibcundercfg(unix), butlibcwas a Linux-only dependency.libcas acfg(unix)dev-dependency. The SAM reset test keeps running on macOS.snapshot_omits_peer_after_tcp_finto Linux. It needsPOLLRDHUP. Off Linux,tcp_has_peer_finalways returns false.Checked on macOS: workspace clippy passes. The full net suite ran 635 of 636; the one failure is the flake below.
Seen once on macOS under full-suite load:
tip_accept::two_full_senders_both_enqueuefailed with "queued 1". It passed 5 of 5 runs alone. Not touched here.🤖 Generated with Claude Code