From 09faa328f93d5911fb30aaa4565380f9bb4acd7f Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Fri, 27 Sep 2019 11:23:39 +0200 Subject: [PATCH] tests: add distinct test app for nrfmin driver --- tests/driver_nrfmin/Makefile | 15 ++++++++++ tests/driver_nrfmin/README.md | 10 +++++++ tests/driver_nrfmin/main.c | 43 +++++++++++++++++++++++++++++ tests/driver_nrfmin/tests/01-run.py | 14 ++++++++++ 4 files changed, 82 insertions(+) create mode 100644 tests/driver_nrfmin/Makefile create mode 100644 tests/driver_nrfmin/README.md create mode 100644 tests/driver_nrfmin/main.c create mode 100755 tests/driver_nrfmin/tests/01-run.py diff --git a/tests/driver_nrfmin/Makefile b/tests/driver_nrfmin/Makefile new file mode 100644 index 0000000000..c6e5d5eeda --- /dev/null +++ b/tests/driver_nrfmin/Makefile @@ -0,0 +1,15 @@ +BOARD ?= nrf52dk +include ../Makefile.tests_common + +# include nrfmin, the main purpose of this test +USEMODULE += nrfmin +# use a minimal GNRC configuration +USEMODULE += gnrc_netdev_default +USEMODULE += auto_init_gnrc_netif +USEMODULE += gnrc_ipv6 +USEMODULE += gnrc_icmpv6_echo +# also add the shell with some basic shell commands +USEMODULE += shell +USEMODULE += shell_commands + +include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_nrfmin/README.md b/tests/driver_nrfmin/README.md new file mode 100644 index 0000000000..b7c23a0745 --- /dev/null +++ b/tests/driver_nrfmin/README.md @@ -0,0 +1,10 @@ +# Test for the `nrfmin` radio driver +The `nrfmin` driver is a RIOT specific driver that runs the on-chip radios on +Nordic nRF5x-based CPUs in a proprietary mode. But per default, we run the nRF's +radios either in BLE mode (using NImBLE), or in IEEE802.15.4 mode (using the +`nrf802154` driver). + +To make sure the `nrfmin` driver is still covered by RIOT's test system, this +test application is added. The test simply contains a basic GNRC configuration +and of course the `nrfmin` driver, which should be enough to verify the drivers +functionality. diff --git a/tests/driver_nrfmin/main.c b/tests/driver_nrfmin/main.c new file mode 100644 index 0000000000..aa2a99cb09 --- /dev/null +++ b/tests/driver_nrfmin/main.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2019 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Test for the Nordic specific nrfmin radio driver + * + * @author Hauke Petersen + * + * @} + */ + +#include + +#include "shell.h" +#include "msg.h" + +#define MAIN_QUEUE_SIZE (8) +static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; + +int main(void) +{ + /* we need a message queue for the thread running the shell in order to + * receive potentially fast incoming networking packets */ + msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); + puts("Test for the RIOT integration of the nrfmin radio driver"); + + /* start shell */ + puts("All up, running the shell now"); + char line_buf[SHELL_DEFAULT_BUFSIZE]; + shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); + + /* should be never reached */ + return 0; +} diff --git a/tests/driver_nrfmin/tests/01-run.py b/tests/driver_nrfmin/tests/01-run.py new file mode 100755 index 0000000000..7329c74091 --- /dev/null +++ b/tests/driver_nrfmin/tests/01-run.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import sys +from testrunner import run + + +def testfunc(child): + child.expect("All up, running the shell now") + child.sendline("ifconfig") + child.expect(r"Iface\s+(\d+)\s+HWaddr:") + + +if __name__ == "__main__": + sys.exit(run(testfunc, timeout=1, echo=False))