From 97d94bb0c2deeeaeed83b8fc0fcf340366860d13 Mon Sep 17 00:00:00 2001 From: Nitesh Balusu Date: Fri, 23 Oct 2026 23:00:40 -0400 Subject: [PATCH] net: build the test suite on macOS 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 #1179 Co-Authored-By: Claude Opus 5.5 --- crates/rbitcoin-net/Cargo.toml | 4 ++++ crates/rbitcoin-net/tests/peer/mod.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/crates/rbitcoin-net/Cargo.toml b/crates/rbitcoin-net/Cargo.toml index f54f772d8b..ee92ea1d04 100644 --- a/crates/rbitcoin-net/Cargo.toml +++ b/crates/rbitcoin-net/Cargo.toml @@ -38,6 +38,10 @@ libc = "0.2" [dev-dependencies] rbitcoin-ibd = { workspace = true } +[target.'cfg(unix)'.dev-dependencies] +# tests/i2p_sam.rs: SO_LINGER 0 resets the fake SAM socket. +libc = "0.2" + [[test]] name = "suite" path = "tests/suite.rs" diff --git a/crates/rbitcoin-net/tests/peer/mod.rs b/crates/rbitcoin-net/tests/peer/mod.rs index 641b7f8339..8210995450 100644 --- a/crates/rbitcoin-net/tests/peer/mod.rs +++ b/crates/rbitcoin-net/tests/peer/mod.rs @@ -3474,6 +3474,8 @@ fn outbound_write_batch_sends_getdata_before_headers() { assert_eq!(batch.len(), 4); } +// `tcp_has_peer_fin` needs POLLRDHUP; off Linux it always reports no FIN. +#[cfg(target_os = "linux")] #[test] fn snapshot_omits_peer_after_tcp_fin() { use bitcoin::p2p::address::Address;