Skip to content

Commit

Permalink
tests: internal: network: prevent Infinite loop for no IPv6 environme…
Browse files Browse the repository at this point in the history
…nt (#6697)

With no IPv6 supported environment, the current implementation causes
infinite loop to wait ev events for network testing.
We should prevent such protocol glitching issue on test to prevent
stucking test cases.

Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
  • Loading branch information
cosmo0920 authored Jan 28, 2023
1 parent 6c9402d commit 1c94702
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/internal/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ static void test_client_server(int is_ipv6)

/* Create client and server sockets */
fd_client = flb_net_socket_create(family, FLB_TRUE);
if (errno == EAFNOSUPPORT) {
TEST_MSG("This protocol is not supported in this platform");
return;
}
TEST_CHECK(fd_client != -1);

fd_server = flb_net_server(TEST_PORT, host);
Expand Down Expand Up @@ -94,6 +98,10 @@ static void test_client_server(int is_ipv6)

/* Event loop */
while (1) {
/* Break immediately for invalid status */
if (fd_client == -1 || fd_server == -1) {
break;
}
mk_event_wait(evl);
mk_event_foreach(e_item, evl) {
if (e_item->type == TEST_EV_CLIENT) {
Expand Down

0 comments on commit 1c94702

Please sign in to comment.