gnrc: improve unittest coverage
This a list of modules that are part of the gnrc network stack and there state concerning unittest:
- [ ] Netdev Ethernet
- No Unittests
- [ ] Device drivers
- [ ] ng_at86rf2xx
- No Unittests
- [ ] ng_nativenet
- No Unittests
- [ ] xbee
- No Unittests
- [ ] kw2xrf
- No Unittests
- [ ] ng_at86rf2xx
- [ ] Network Interfaces
- 19 unittests exist in
tests/unittests - Coverage: medium
- [ ] Generic Network Interface Header
- No Unittests
- 19 unittests exist in
- [ ] Network Protocol Registry
- 12 unittests exist in
tests/unittests - Coverage: low (interface has 8 functions with various parameters)
- 12 unittests exist in
- [ ] Packet Buffer
- 38 unittests exist in
tests/unittests - Coverage: low to medium (this module is very complex and powerful and has 9 functions)
- 38 unittests exist in
- [ ] NETAPI
- No Unittests
- [ ] NETAPI Test Framework
- No Unittests
- [ ] Nomac
- No Unittests
- [ ] SLIP
- No Unittests
- [ ] NDP
- No Unittests
- [ ] 6LoWPAN (@OlegHahm is working on this)
- No Unittests
- [ ] 6LoWPAN Contexts
- 11 unittests exist in
tests/unittests - Coverage: medium
- 11 unittests exist in
- [ ] 6LoWPAN Fragmentation (@OlegHahm is working on this)
- No Unittests
- [ ] 6LoWPAN Header Compression
- No Unittests
- [ ] 6LoWPAN Network Interfaces (@OlegHahm is working on this)
- No Unittests
- [ ] IPv6 (@A-Paul is working on this)
- No Unittests
- [ ] netapi interface
- No Unittests
- [ ] IPv6 Address
- 67 unittests exist in
tests/unittests - Coverage: medium (The interface contains many functions and macros.)
- 67 unittests exist in
- [ ] IPv6 Header (@A-Paul is working on this)
- 17 unittests exist in
tests/unittests - Coverage: low (The interface has ~15 functions.)
- 17 unittests exist in
- [ ] IPv6 Extension Header (@A-Paul is working on this)
- No Unittests
- [ ] IPv6 Extension Routing Header
- No Unittests
- [ ] IPv6 Neighbor Cache
- 27 unittests exist in
tests/unittests - Coverage: medium
- 27 unittests exist in
- [ ] IPv6 Network Interfaces
- 34 unitttests exist in
tests/unittests - Coverage: low to medium (The interface contains many functions.)
- 34 unitttests exist in
- [ ] ICMPv6
- No Unittests
- [ ] ECHO
- No Unittests
- [ ] Upper Layer/Inet Checksum
- 5 unittests exist in
tests/unittests - Coverage: low (Much more input values should be checked)
- 5 unittests exist in
- [ ] FIB
- 16 unitests exist in
test/unittests - Coverage: low (The FIB interface contains 10 non-debugging functions with many parameters.)
- 16 unitests exist in
- [ ] RPL
- No Unittests
- [ ] RPL Source Routing Header
- No Unittests
- [ ] UDP
- No Unittests
- [ ] netapi interface
- 5 unittests exist in #3248 (
tests/udp)
- 5 unittests exist in #3248 (
- [ ] NHDP
- No Unittests
The intention of this issue is to keep track of the coverage of unittests per module and improve it.
Please note: currently I only counted the number of the existing unittests without stating anything about their quality or coverage. I will update this information ASAP.
At least for the netapi part of UDP there is #3248. There is still need for ng_udp_hdr_build() and such.
Some unittests based on pexpect or similar modules for the network device drivers are also thinkable. We can use the driver's test apps as a starting point.
@A-Paul may be interested in this list.
@authmillenon, feel free to edit the list and add links to PRs etc. We can also change the format if someone has a better idea. So far, it's more or less a dump.
@PeterKietzmann, yes he is. Thanks. :-)
By now (still no familiar with the structure and history of RIOT) I'm confused by figuring out:
- How the list entries map to the header files in sys/include/net.
- Where to find the specific untittests for the new network stack in "tests/unittests/" and other directories under "tests/" (Unsure if "tests/udp" is the only exception).
- And again, how those map to the modules and/or header files.
@OlegHahm or @authmillenon can you give me some advice in this?
- @A-Paul, currently it's a bit confusing as we have both the old and the new network stack in master. Modules related to the new stack are prefixed with
ng_. In sys/include/net there are only header files related to the new stack. Except the device driver interfaces you should find all relevant headers there. For example: "Netdev Ethernet" relates tong_netdev_eth.h, "Packet Bufferrelates tong_pktbuf.h`. .. Which module do you have in mind to work on? - Unittests are placed in tests/unittests/__. The tests placed in *tests/* are more to understand as demo of a module.
- For example: As stated above, the module "IPv6 Address" already has some unit tests. You can find them in RIOT/tests/unittests/tests-ipv6_addr/. If you feel insecure if a tests relates to the new network stack, you can have a look inside the Makefile.include. There you can see that a
ng_-prefixed module is included.
Did I answer your questions?
- Unittests are placed in tests/unittests/. The tests placed in tests/ are more to understand as demo of a module.
That is not true, IMHO. tests/ contains what it says: test application. Most of them utilize the shell and are missing a proper execution script, but they are still tests. Anyway my rational behind creating a new test application for every netapi integration test was, that tests/unittests is to be used only for tests not involving threads, timers, IPC etc. (because those things are hard to map in simple unittests) and threads/IPC related tests to use seperate test applications. The unittests are already quite big and don't fit in total on all of our supported boards, so adding thread-stacks to it the situation wouldn't get better.
- For example: As stated above, the module "IPv6 Address" already has some unit tests. You can find them in RIOT/tests/unittests/tests-ipv6_addr/. If you feel insecure if a tests relates to the new network stack, you can have a look inside the Makefile.include. There you can see that a ng_-prefixed module is included.
Maybe it is helpful, if someone™ with some insight into the network stack can update the list with the according header files and test locations ;-)
@authmillenon naming them as "demo" was a bit imprecise, I agree. I was thinking about driver tests I guess. Anyway, in this issue we are talking about the bare unittest, right? This should be the location that we are focusing on. IMO that's something where "not-so-gnrc-experienced" people can support.
Anyway, in this issue we are talking about the bare unittest, right? This should be the location that we are focusing on. IMO that's something where "not-so-gnrc-experienced" people can support.
@PeterKietzmann Yes, but they are the least interesting in terms of complexity for the stack. The netapi calls are really what glues everything together/where the most seems to go wrong ;-).
@authmillenon naming them as "demo" was a bit imprecise, I agree. I was thinking about driver tests I guess.
@A-Paul was referring to these tests as Smoke Tests
@authmillenon I never wanted to say that they are not interesting :-) ! @OlegHahm I'm not sure I got what you wanted to tell me. Anyway, it would be nice if you manage this testing, I'll better keep me out to avoid inconsistencies. @katezilla could also be interested
@PeterKietzmann, I just think that "smoke testing" seems to be the most correct term for most of the applications located directly under tests/.
Can someone shed some light on how the coverage is defined?
In theory, see https://en.wikipedia.org/wiki/Code_coverage. In practice, as I wrote, this is for now just a very rough estimation based on the number of functions per interface and the number and range of parameters.
@authmillenon, am I right to assume that network interface PIDs are not checked when added to IPv6 or 6LoWPAN (e.g. in ng_sixlowpan_netif_add())? If yes, we should document this behavior.
What do you mean with "checked"? Usually they are called by ng_netif_add so there is no need to check if they are an interface.
What happens if a I call, for instance, ng_sixlowpan_netif_add() with a random ID? Will it check if this ID is a valid PID or just add the (potentially not existing) interface to 6lowpan?
Will add it.
While looking through the existing tests I've seen a lot of locallly defined data stubs. I may be usefull if those who are sufficient for other test could go into into unittests-constants.h. Ideally including a short comment which special state/case they represent.