darwin,test: squelch EBUSY error on multicast join

The firewall was suspected to be the culprit, but the test
intermittently fails in the CI, not locally.
This commit is contained in:
Saúl Ibarra Corretgé 2024-10-22 10:01:43 +02:00
parent e129cd7fda
commit d4ab6fbba4

View File

@ -36,10 +36,9 @@ static uv_udp_t client;
static uv_udp_send_t req;
static uv_udp_send_t req_ss;
static int darwin_ebusy_errors;
static int cl_recv_cb_called;
static int sv_send_cb_called;
static int close_cb_called;
static void alloc_cb(uv_handle_t* handle,
@ -128,6 +127,13 @@ static void cl_recv_cb(uv_udp_t* handle,
#if !defined(__NetBSD__)
r = uv_udp_set_source_membership(&server, MULTICAST_ADDR, NULL, source_addr, UV_JOIN_GROUP);
#if defined(__APPLE__)
if (r == UV_EBUSY) {
uv_close((uv_handle_t*) &server, close_cb);
darwin_ebusy_errors++;
return;
}
#endif
ASSERT_OK(r);
#endif
@ -177,6 +183,9 @@ TEST_IMPL(udp_multicast_join) {
/* run the loop till all events are processed */
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
if (darwin_ebusy_errors > 0)
RETURN_SKIP("Unexplained macOS IP_ADD_SOURCE_MEMBERSHIP EBUSY bug");
ASSERT_EQ(2, cl_recv_cb_called);
ASSERT_EQ(2, sv_send_cb_called);
ASSERT_EQ(2, close_cb_called);