From 1064b29f9485471c9ce5c07d1163ac90d62599b6 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Mon, 12 Aug 2024 13:22:03 -0700 Subject: [PATCH] fix `uds_stream::epollhup` test --- tokio/tests/uds_stream.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tokio/tests/uds_stream.rs b/tokio/tests/uds_stream.rs index b8c4e6a8e..514037185 100644 --- a/tokio/tests/uds_stream.rs +++ b/tokio/tests/uds_stream.rs @@ -406,6 +406,16 @@ async fn epollhup() -> io::Result<()> { drop(listener); let err = connect.await.unwrap_err(); - assert_eq!(err.kind(), io::ErrorKind::ConnectionReset); + + // On illumos (and presumably other Solaris descendents), `connect(3SOCKET)` + // returns `ECONNREFUSED` here rather than `ECONNRESET`. + // + // See: https://illumos.org/man/3SOCKET/connect + let expected_errno = if cfg!(target_os = "illumos") || cfg!(target_os = "solaris") { + io::ErrorKind::ConnectionRefused + } else { + io::ErrorKind::ConnectionReset + }; + assert_eq!(err.kind(), expected_errno); Ok(()) }