Skip to content

Commit

Permalink
tests: provide initial tests for gnrc_ipv6_ext_frag
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jun 3, 2019
1 parent c9873a4 commit 2db3e8a
Show file tree
Hide file tree
Showing 5 changed files with 920 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/gnrc_ipv6_ext_frag/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
DEVELHELP := 1
# name of your application
include ../Makefile.tests_common

BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano \
arduino-uno hifive1 i-nucleo-lrwan1 mega-xplained \
msb-430 msb-430h nucleo-f030r8 nucleo-f031k6 \
nucleo-f042k6 nucleo-f070rb nucleo-f072rb \
nucleo-f303k8 nucleo-f334r8 nucleo-l031k6 \
nucleo-l053r8 saml10-xpro saml11-xpro \
stm32f0discovery telosb thingy52 waspmote-pro \
wsn430-v1_3b wsn430-v1_4 z1
# chronos, hamilton, mips-malta, and ruuvitag boards don't support ethos
BOARD_BLACKLIST := chronos hamilton mips-malta ruuvitag

export TAP ?= tap0

CFLAGS += -DOUTPUT=TEXT
CFLAGS += -DTEST_SUITES="gnrc_ipv6_ext_frag"
CFLAGS += -DGNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE=3

# use Ethernet as link-layer protocol
ifeq (native,$(BOARD))
USEMODULE += netdev_tap

TERMFLAGS ?= $(TAP)
else
USEMODULE += ethos

ETHOS_BAUDRATE ?= 115200
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
TERMDEPS += ethos
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
endif
USEMODULE += auto_init_gnrc_netif
# Specify the mandatory networking modules for IPv6
USEMODULE += gnrc_ipv6_router_default
USEMODULE += gnrc_icmpv6_error
USEMODULE += gnrc_pktdump
USEMODULE += gnrc_pktbuf_cmd
# IPv6 extension headers
USEMODULE += gnrc_ipv6_ext_frag
# UDP support for payload
USEMODULE += gnrc_udp
USEMODULE += od
# Add unittest framework
USEMODULE += embunit
# Add also the shell, some shell commands
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps

# TEST_ON_CI_WHITELIST += all

.PHONY: ethos

ethos:
$(Q)env -u CC -u CFLAGS make -C $(RIOTTOOLS)/ethos

include $(RIOTBASE)/Makefile.include
36 changes: 36 additions & 0 deletions tests/gnrc_ipv6_ext_frag/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# `gnrc_ipv6_ext_frag` test

This test utilizes [scapy] to test the IPv6 Extension header parsing.

It is intended to just test the fragmentation header handling and generation.
For other extension header types please provide a separate test application.

To test, compile and flash the application to any board of your liking (since
`ethos` is used to communicate with non-native boards it really doesn't matter
as long as the application fits).

```
make flash
```

And run the tests using

```
sudo make test
```

Note that root privileges are required since `scapy` needs to construct Ethernet
frames to properly communicate over the TAP interface.

The tests succeeds if you see the string `SUCCESS`.

If any problems are encountered (i.e. if the test prints the sting `FAILED`),
set the echo parameter in the `run()` function at the bottom of the test script
(tests/01-run.py) to `True`. The test script will then offer a more detailed
output.

It might be that due to `scapy`'s sniffer not picking up an expected packet
sometimes that the test application hangs for a while and then issues `FAILED`.
Just restart the test in that case.

[scapy]: https://scapy.readthedocs.io/en/latest/
Loading

0 comments on commit 2db3e8a

Please sign in to comment.