[riot-notifications] [RIOT-OS/RIOT] gnrc/netif: add IPv6 event bus (#14022)

Martine Lenders notifications at github.com
Wed May 13 15:22:26 CEST 2020


I tested just the setting of a valid address, and there seems to be a problem :-/

I patched the `tests/gnrc_netif` test as follows:

```diff
diff --git a/tests/gnrc_netif/Makefile b/tests/gnrc_netif/Makefile
index 2e91ce872..1f44c234e 100644
--- a/tests/gnrc_netif/Makefile
+++ b/tests/gnrc_netif/Makefile
@@ -3,6 +3,7 @@ include ../Makefile.tests_common
 USEMODULE += embunit
 USEMODULE += gnrc_netif
 USEMODULE += gnrc_pktdump
+USEMODULE += gnrc_netif_bus
 USEMODULE += gnrc_sixlowpan
 USEMODULE += gnrc_sixlowpan_iphc
 USEMODULE += gnrc_ipv6
diff --git a/tests/gnrc_netif/main.c b/tests/gnrc_netif/main.c
index 13f6cdffe..ec01ca562 100644
--- a/tests/gnrc_netif/main.c
+++ b/tests/gnrc_netif/main.c
@@ -251,6 +251,12 @@ static void test_ipv6_addr_add__success(void)
 {
     static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL };
     int idx;
+    msg_t m;
+    msg_bus_entry_t sub;
+    msg_bus_t *bus = gnrc_netif_get_bus(gnrc_netif_iter(NULL), GNRC_NETIF_BUS_IPV6);
+
+    msg_bus_attach(bus, &sub);
+    msg_bus_subscribe(&sub, GNRC_IPV6_EVENT_ADDR_VALID);
 
     TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_addr_add_internal(&netifs[0], &addr, 64U,
                                                      GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)));
@@ -261,6 +267,9 @@ static void test_ipv6_addr_add__success(void)
     TEST_ASSERT_EQUAL_INT(GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID,
                           netifs[0].ipv6.addrs_flags[idx]);
     TEST_ASSERT(ipv6_addr_equal(&addr, &netifs[0].ipv6.addrs[idx]));
+    TEST_ASSERT(xtimer_msg_receive_timeout(&m, 1000000) >= 0);
+    TEST_ASSERT(memcmp(&addr, m.content.ptr, sizeof(addr)) == 0);
+    msg_bus_detach(bus, &sub);
 }
 
 static void test_ipv6_addr_add__readd_with_free_entry(void)
```

and ran it

<details><summary><code>RIOT_CI_BUILD=1 make -C tests/gnrc_netif all test --no-print-directory</code></summary>

``` 
Building application "tests_gnrc_netif" for "native" with MCU "native".

   text	   data	    bss	    dec	    hex	filename
 217571	   1372	 130436	 349379	  554c3	/home/mlenders/Repositories/RIOT-OS/RIOT/tests/gnrc_netif/bin/native/tests_gnrc_netif.elf
r
/home/mlenders/Repositories/RIOT-OS/RIOT/tests/gnrc_netif/bin/native/tests_gnrc_netif.elf  
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.

Help: Press s to start test, r to print it is ready
READY
s
START
......
tests.test_ipv6_addr_add__success (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
..
tests.test_ipv6_addr_remove__not_allocated (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
..
tests.test_ipv6_addr_remove__success (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
...
tests.test_ipv6_addr_idx__wrong_netif (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
..
tests.test_ipv6_addr_idx__wrong_addr (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
..
tests.test_ipv6_addr_idx__success (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
...
tests.test_ipv6_addr_match__wrong_netif (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
..
tests.test_ipv6_addr_match__wrong_addr (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
....
tests.test_ipv6_addr_best_src__multicast_input (tests/gnrc_netif/main.c 270) xtimer_msg_receive_timeout(&m, 1000000) >= 0
..Timeout in expect script at "child.expect(r'OK \((\d+) tests\)', timeout=timeout)" (dist/pythonlibs/testrunner/__init__.py:57)
  File "/home/mlenders/Repositories/RIOT-OS/RIOT/dist/pythonlibs/testrunner/__init__.py", line 30, in run
    testfunc(child)
  File "/home/mlenders/Repositories/RIOT-OS/RIOT/tests/gnrc_netif/tests/01-run.py", line 16, in testfunc
    check_unittests(child)
  File "/home/mlenders/Repositories/RIOT-OS/RIOT/dist/pythonlibs/testrunner/__init__.py", line 57, in check_unittests
    child.expect(r'OK \((\d+) tests\)', timeout=timeout)
  File "/usr/lib/python3.8/site-packages/pexpect/spawnbase.py", line 343, in expect
    return self.expect_list(compiled_pattern_list,
  File "/usr/lib/python3.8/site-packages/pexpect/spawnbase.py", line 372, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/lib/python3.8/site-packages/pexpect/expect.py", line 181, in expect_loop
    return self.timeout(e)
  File "/usr/lib/python3.8/site-packages/pexpect/expect.py", line 144, in timeout
    raise exc

make: *** [/home/mlenders/Repositories/RIOT-OS/RIOT/tests/gnrc_netif/../../Makefile.include:763: test] Error 1

```
<details>

Appearently, the message never reaches the subscriber :-(

-- 
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/14022#issuecomment-627982085
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200513/dff7491e/attachment.htm>


More information about the notifications mailing list