Skip to content

Commit

Permalink
tests: Add functionality test for netdev_base
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Oct 1, 2014
1 parent 65e0bd5 commit 5596af6
Show file tree
Hide file tree
Showing 4 changed files with 1,359 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tests/netdev/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

SENDER ?= 0
ifeq (0,$(SENDER))
export APPLICATION = netdev_receiver
else
export APPLICATION = netdev_sender
endif

include ../Makefile.tests_common

USEMODULE += defaulttransceiver
USEMODULE += netdev_base

DISABLE_MODULE += auto_init

INCLUDES += -I$(RIOTBASE)/sys/net/include

CHANNEL ?= 1
SENDER_ADDRESS ?= 1
RECEIVER_ADDRESS ?= 2
NID ?= 0

ifeq (native,$(BOARD))
RECEIVER_PORT ?= tap0
SENDER_PORT ?= tap1
else
RECEIVER_PORT ?= /dev/ttyUSB1
SENDER_PORT ?= /dev/ttyUSB0
endif

ifeq (0,$(SENDER))
CFLAGS += -DRECEIVER
CFLAGS += -DNETDEV_TEST_ADDRESS=$(RECEIVER_ADDRESS)
PORT ?= $(RECEIVER_PORT)
else
CFLAGS += -DSENDER
CFLAGS += -DNETDEV_TEST_ADDRESS=$(SENDER_ADDRESS)
PORT ?= $(SENDER_PORT)
endif

include $(RIOTBASE)/Makefile.include

CFLAGS += -DNETDEV_TEST_CHANNEL=$(CHANNEL)
CFLAGS += -DNETDEV_TEST_NID=$(NID)
CFLAGS += -DNETDEV_TEST_RECEIVER=$(RECEIVER_ADDRESS)
CFLAGS += -DNETDEV_TEST_SENDER=$(SENDER_ADDRESS)

test:
./tests/01-interaction.py
21 changes: 21 additions & 0 deletions tests/netdev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# netdev tests
This application tests the module `netdev`, it's base module `netdev_base` in
particular.
The tests can be automated by running

```bash
SENDER=0 make all flash && SENDER=1 make all flash && make test
```

The values of the network addresses, the channel, and the network ID can be
configured by the environment variables

* `NETDEV_TEST_RECEIVER` and `NETDEV_TEST_SENDER`,
* `NETDEV_TEST_CHANNEL`,
* `NETDEV_TEST_NID`

You can set the role of the application by setting the `SENDER` variable to
either 0 (application is receiver) or any other value (applictation is sender),
but keep in mind, that both versions have to be flashed to to seperate devices
(identified by `RECEIVER_PORT` and `SENDER_PORT` respectively) in order for
`make test` to succeed.
Loading

0 comments on commit 5596af6

Please sign in to comment.