[riot-notifications] [RIOT-OS/RIOT] gnrc/netif: add gnrc_netif_ipv6_wait_for_global_address() (#16824)

Martine Lenders notifications at github.com
Thu Sep 16 16:24:01 CEST 2021


@miri64 requested changes on this pull request.

Only some test hardening left.

> +    TEST_ASSERT_EQUAL_INT(TEST_NETIF_NUMOF, gnrc_netif_numof());
+    TEST_ASSERT(!gnrc_netif_ipv6_wait_for_global_address(NULL, 10));
+    TEST_ASSERT(!gnrc_netif_ipv6_wait_for_global_address(&netif_test[0], 10));
+}
+
+static void test_wait_success(void)
+{
+    unsigned now;
+
+    TEST_ASSERT_EQUAL_INT(TEST_NETIF_NUMOF, gnrc_netif_numof());
+
+    /* no event when adding addr to other interface */
+    _add_delayed_addr(&netif_test[1]);
+    now = xtimer_now_usec();
+    TEST_ASSERT(!gnrc_netif_ipv6_wait_for_global_address(&netif_test[0], 20));
+    TEST_ASSERT_EQUAL_INT(20, (xtimer_now_usec() - now + 500) / 1000);

```suggestion
    TEST_ASSERT(20 <= ((xtimer_now_usec() - now) / 1000));
```

Using `EQUAL_INT` is a bit optimistic IMHO, so rather check if `20 <=` the time difference (I used yoda style in the suggestion, to make the change more clearer, feel free to use `<= 20` instead ;-)).

> +    /* event when adding addr to any interface */
+    _add_delayed_addr(&netif_test[0]);
+    TEST_ASSERT(gnrc_netif_ipv6_wait_for_global_address(NULL, 20));

This one doesn't have a delay?

> +    /* event when adding addr to specified interface */
+    _add_delayed_addr(&netif_test[0]);
+    TEST_ASSERT(gnrc_netif_ipv6_wait_for_global_address(&netif_test[0], 20));

If I understand this correctly, there should be a delay here as well ;-).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16824#pullrequestreview-756370979
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210916/b878012a/attachment-0001.htm>


More information about the notifications mailing list