Skip to content

Commit 3e5ce5c

Browse files
ellertbluca
authored andcommitted
The tests/test_radio_dish test implements is_multicast_available() to
verify that multicast is working on the system before running tests that relies on this, or skipping those test otherwise. In some circumstances this check itself hangs due to the recvfrom() call being blocking waiting for data. The test is eventually killed with a SIGALARM signal. ./config/test-driver: line 112: 1227308 Alarm clock "$@" >> "$log_file" 2>&1 FAIL: tests/test_radio_dish FAIL: tests/test_radio_dish =========================== FAIL tests/test_radio_dish (exit status: 142) $ tests/test_radio_dish tests/test_radio_dish.cpp:511:test_leave_unjoined_fails:PASS tests/test_radio_dish.cpp:512:test_join_too_long_fails:PASS tests/test_radio_dish.cpp:513:test_long_group:PASS tests/test_radio_dish.cpp:514:test_join_twice_fails:PASS tests/test_radio_dish.cpp:515:test_radio_bind_fails_ipv4:PASS tests/test_radio_dish.cpp:516:test_radio_bind_fails_ipv6:PASS tests/test_radio_dish.cpp:517:test_dish_connect_fails_ipv4:PASS tests/test_radio_dish.cpp:518:test_dish_connect_fails_ipv6:PASS tests/test_radio_dish.cpp:519:test_radio_dish_tcp_poll_ipv4:PASS tests/test_radio_dish.cpp:520:test_radio_dish_tcp_poll_ipv6:PASS tests/test_radio_dish.cpp:521:test_radio_dish_udp_ipv4:PASS tests/test_radio_dish.cpp:522:test_radio_dish_udp_ipv6:PASS Alarm clock With this commit, making the recvfrom() call non-blocking. The test does noy hang, and the non-available multicast is detected and the tests needing it are skipped: PASS: tests/test_radio_dish $ tests/test_radio_dish tests/test_radio_dish.cpp:510:test_leave_unjoined_fails:PASS tests/test_radio_dish.cpp:511:test_join_too_long_fails:PASS tests/test_radio_dish.cpp:512:test_long_group:PASS tests/test_radio_dish.cpp:513:test_join_twice_fails:PASS tests/test_radio_dish.cpp:514:test_radio_bind_fails_ipv4:PASS tests/test_radio_dish.cpp:515:test_radio_bind_fails_ipv6:PASS tests/test_radio_dish.cpp:516:test_dish_connect_fails_ipv4:PASS tests/test_radio_dish.cpp:517:test_dish_connect_fails_ipv6:PASS tests/test_radio_dish.cpp:518:test_radio_dish_tcp_poll_ipv4:PASS tests/test_radio_dish.cpp:519:test_radio_dish_tcp_poll_ipv6:PASS tests/test_radio_dish.cpp:520:test_radio_dish_udp_ipv4:PASS tests/test_radio_dish.cpp:521:test_radio_dish_udp_ipv6:PASS tests/test_radio_dish.cpp:431:test_radio_dish_mcast_ipv4:IGNORE: No multicast available tests/test_radio_dish.cpp:431:test_radio_dish_no_loop_ipv4:IGNORE: No multicast available tests/test_radio_dish.cpp:431:test_radio_dish_mcast_ipv6:IGNORE: No multicast available tests/test_radio_dish.cpp:431:test_radio_dish_no_loop_ipv6:IGNORE: No multicast available ----------------------- 16 Tests 0 Failures 4 Ignored OK
1 parent dd7369b commit 3e5ce5c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/test_radio_dish.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static bool is_multicast_available (int ipv6_)
321321
struct sockaddr_in *mcast_ipv4 = &mcast.ipv4;
322322

323323
any_ipv4->sin_family = AF_INET;
324-
any_ipv4->sin_port = htons (5555);
324+
any_ipv4->sin_port = htons (port);
325325

326326
rc = test_inet_pton (AF_INET, "0.0.0.0", &any_ipv4->sin_addr);
327327
if (rc == 0) {
@@ -395,15 +395,23 @@ static bool is_multicast_available (int ipv6_)
395395

396396
msleep (SETTLE_TIME);
397397

398-
rc = sendto (send_sock, msg, static_cast<socklen_t> (strlen (msg)), 0,
398+
#ifdef ZMQ_HAVE_WINDOWS
399+
rc = sendto (send_sock, msg, static_cast<int> (strlen (msg)), 0,
399400
&mcast.generic, sl);
401+
#else
402+
rc = sendto (send_sock, msg, strlen (msg), 0, &mcast.generic, sl);
403+
#endif
400404
if (rc < 0) {
401405
goto out;
402406
}
403407

404408
msleep (SETTLE_TIME);
405409

410+
#ifdef ZMQ_HAVE_WINDOWS
406411
rc = recvfrom (bind_sock, buf, sizeof (buf) - 1, 0, NULL, 0);
412+
#else
413+
rc = recvfrom (bind_sock, buf, sizeof (buf) - 1, MSG_DONTWAIT, NULL, 0);
414+
#endif
407415
if (rc < 0) {
408416
goto out;
409417
}

0 commit comments

Comments
 (0)