Skip to content

Commit 2e73e7f

Browse files
committed
tests: add Nordic SoftDevice test app
1 parent 4e45502 commit 2e73e7f

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

tests/nordic_softdevice/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
BOARD ?= nrf52dk
2+
include ../Makefile.tests_common
3+
4+
# Use the Nordic SoftDevice
5+
USEPKG += nordic_softdevice_ble
6+
7+
# use a minimal GNRC configuration
8+
USEMODULE += gnrc_netdev_default
9+
USEMODULE += auto_init_gnrc_netif
10+
USEMODULE += gnrc_ipv6
11+
USEMODULE += gnrc_icmpv6_echo
12+
# also add the shell with some basic shell commands
13+
USEMODULE += shell
14+
USEMODULE += shell_commands
15+
USEMODULE += ps
16+
17+
TEST_ON_CI_WHITELIST += nrf52dk
18+
19+
include $(RIOTBASE)/Makefile.include

tests/nordic_softdevice/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Nordic SoftDevice Test Application
2+
The main purpose of this test application is to ensure the inclusion of the
3+
Nordic SoftDevice package in RIOTs build test.
4+
5+
In addition, this example includes a minimal GNRC configuration and the
6+
corresponding shell commands, so it can be used for some simple tests of
7+
network functionality. Please refer to `pkg/nordic_softdevice_ble/README.md`
8+
and `pkg/nordic_softdevice_ble/README-BLE-6LoWPAN.md` for more information on
9+
how to setup an IPv6 connection to your device.
10+
11+
For more features, you can use the SoftDevice with RIOTs `gnrc_networking`
12+
example application. Simply build `gnrc_networking` for a SoftDevice-capable
13+
device, e.g. `USEPKG=nordic_softdevice_ble BOARD=nrf52dk make ...`.

tests/nordic_softdevice/main.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (C) 2019 Freie Universität Berlin
3+
*
4+
* This file is subject to the terms and conditions of the GNU Lesser
5+
* General Public License v2.1. See the file LICENSE in the top level
6+
* directory for more details.
7+
*/
8+
9+
/**
10+
* @ingroup tests
11+
* @{
12+
*
13+
* @file
14+
* @brief This test application ensures that the Nordic SoftDevice
15+
* integration is included in the build test
16+
*
17+
* @author Hauke Petersen <[email protected]>
18+
*
19+
* @}
20+
*/
21+
22+
#include <stdio.h>
23+
24+
#include "shell.h"
25+
#include "msg.h"
26+
27+
#define MAIN_QUEUE_SIZE (8)
28+
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
29+
30+
int main(void)
31+
{
32+
/* we need a message queue for the thread running the shell in order to
33+
* receive potentially fast incoming networking packets */
34+
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
35+
puts("Test for the RIOT integration of the Nordic SoftDevice");
36+
37+
/* start shell */
38+
puts("All up, running the shell now");
39+
char line_buf[SHELL_DEFAULT_BUFSIZE];
40+
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
41+
42+
/* should be never reached */
43+
return 0;
44+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
from testrunner import run
5+
6+
7+
def testfunc(child):
8+
child.expect("All up, running the shell now")
9+
child.sendline("ifconfig")
10+
child.expect(r"Iface\s+(\d+)\s+HWaddr:")
11+
12+
13+
if __name__ == "__main__":
14+
sys.exit(run(testfunc, timeout=1, echo=False))

0 commit comments

Comments
 (0)