Skip to content

Commit d4dc516

Browse files
kderdammahadevan108
authored andcommitted
tests: net: mld: fix waiting for MLDv2 report after query
This commit fixes 'test_verify_send_report()' function as it was not properly waiting for a MLDv2 report after sending a query. The asserted value was set for the previous report sent after joining a group. Signed-off-by: Konrad Derda <[email protected]>
1 parent 377756e commit d4dc516

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

tests/net/mld/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ CONFIG_NET_BUF_TX_COUNT=20
2121
CONFIG_NET_MGMT=y
2222
CONFIG_NET_MGMT_EVENT=y
2323
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=4
24-
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=4
24+
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
2525
CONFIG_NET_SOCKETS=y

tests/net/mld/src/main.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,25 +484,39 @@ static void test_catch_query(void)
484484

485485
static void test_verify_send_report(void)
486486
{
487+
join_mldv2_capable_routers_group();
488+
487489
is_query_received = false;
488490
is_report_sent = false;
489491

490492
ignore_already = true;
491493

494+
k_sem_reset(&wait_data);
495+
492496
test_join_group();
493497

498+
k_yield();
499+
500+
/* Did we send a report? */
501+
if (k_sem_take(&wait_data, K_MSEC(WAIT_TIME))) {
502+
zassert_true(0, "Timeout while waiting for report");
503+
}
504+
505+
k_sem_reset(&wait_data);
506+
507+
is_report_sent = false;
494508
send_query(net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)));
495509

496510
k_yield();
497511

498512
/* Did we send a report? */
499513
if (k_sem_take(&wait_data, K_MSEC(WAIT_TIME))) {
500-
zassert_true(0, "Timeout while waiting report");
514+
zassert_true(0, "Timeout while waiting for report");
501515
}
502516

503-
if (!is_report_sent) {
504-
zassert_true(0, "Report not sent");
505-
}
517+
zassert_true(is_report_sent, "Report not sent");
518+
519+
leave_mldv2_capable_routers_group();
506520
}
507521

508522
/* This value should be longer that the one in net_if.c when DAD timeouts */

0 commit comments

Comments
 (0)