Skip to content

Commit 397cebb

Browse files
committed
define-out some tests that can't be fixed on Windows
1 parent f9849dc commit 397cebb

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

FlyingFox/Tests/HTTPServerTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ actor HTTPServerTests {
377377
)
378378
}
379379

380+
#if !canImport(WinSDK)
381+
// FIXME: This test fails non-deterministically on Windows
380382
@Test
381383
func server_AllowsExistingConnectionsToDisconnect_WhenStopped() async throws {
382384
let server = HTTPServer.make()
@@ -397,6 +399,7 @@ actor HTTPServerTests {
397399
)
398400
await taskStop.value
399401
}
402+
#endif
400403

401404
@Test
402405
func server_DisconnectsWaitingRequests_WhenStopped() async throws {

FlyingSocks/Tests/AsyncSocketTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,19 @@ struct AsyncSocketTests {
188188
)
189189
}
190190

191+
#if !canImport(WinSDK)
191192
@Test
192193
func datagramSocketReceivesChunk_WhenAvailable() async throws {
193194
let (s1, s2, addr) = try await AsyncSocket.makeDatagramPair()
194195

195196
async let d2: (any SocketAddress, [UInt8]) = s2.receive(atMost: 100)
196197
// TODO: calling send() on Darwin to an unconnected datagram domain
197198
// socket returns EISCONN
198-
#if canImport(Darwin)
199+
#if canImport(Darwin)
199200
try await s1.write("Swift".data(using: .utf8)!)
200-
#else
201+
#else
201202
try await s1.send("Swift".data(using: .utf8)!, to: addr)
202-
#endif
203+
#endif
203204
let v2 = try await d2
204205
#expect(String(data: Data(v2.1), encoding: .utf8) == "Swift")
205206

@@ -208,7 +209,6 @@ struct AsyncSocketTests {
208209
try? Socket.unlink(addr)
209210
}
210211

211-
#if !canImport(WinSDK)
212212
#if canImport(Darwin)
213213
@Test
214214
func messageSequence_sendsMessage_receivesTuple() async throws {

FlyingSocks/Tests/SocketTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ struct SocketTests {
131131
}
132132
}
133133

134+
#if !canImport(WinSDK)
135+
// Not a good test on Windows, unfortunately:
136+
// https://groups.google.com/g/microsoft.public.win32.programmer.networks/c/rBg0a8oERGQ/m/AvVOd-BIHhMJ
137+
// "If necessary, Winsock can buffer significantly more than the SO_SNDBUF buffer size."
138+
134139
@Test
135140
func socketWrite_ThrowsBlocked_WhenBufferIsFull() throws {
136141
let (s1, s2) = try Socket.makeNonBlockingPair()
@@ -145,6 +150,7 @@ struct SocketTests {
145150
try s1.close()
146151
try s2.close()
147152
}
153+
#endif
148154

149155
@Test
150156
func socketWrite_Throws_WhenSocketIsNotConnected() async throws {
@@ -193,6 +199,8 @@ struct SocketTests {
193199
#expect(try socket.getValue(for: .localAddressReuse) == false)
194200
}
195201

202+
#if !canImport(WinSDK)
203+
// Windows only supports setting O_NONBLOCK, and currently can't retrieve whether it's been set :)
196204
@Test
197205
func socket_Sets_And_Gets_Flags() throws {
198206
let socket = try Socket(domain: AF_UNIX, type: .stream)
@@ -201,6 +209,7 @@ struct SocketTests {
201209
try socket.setFlags(.append)
202210
#expect(try socket.flags.contains(.append))
203211
}
212+
#endif
204213

205214
@Test
206215
func socketAccept_ThrowsError_WhenInvalid() {

0 commit comments

Comments
 (0)