mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #11797 from haukepetersen/add_test_softdevice
tests: add Nordic SoftDevice test app
This commit is contained in:
commit
a04d83e99f
19
tests/nordic_softdevice/Makefile
Normal file
19
tests/nordic_softdevice/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
BOARD ?= nrf52dk
|
||||
include ../Makefile.tests_common
|
||||
|
||||
# Use the Nordic SoftDevice
|
||||
USEPKG += nordic_softdevice_ble
|
||||
|
||||
# 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
|
||||
USEMODULE += ps
|
||||
|
||||
TEST_ON_CI_WHITELIST += nrf52dk
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
13
tests/nordic_softdevice/README.md
Normal file
13
tests/nordic_softdevice/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Nordic SoftDevice Test Application
|
||||
The main purpose of this test application is to ensure the inclusion of the
|
||||
Nordic SoftDevice package in RIOTs build test.
|
||||
|
||||
In addition, this example includes a minimal GNRC configuration and the
|
||||
corresponding shell commands, so it can be used for some simple tests of
|
||||
network functionality. Please refer to `pkg/nordic_softdevice_ble/README.md`
|
||||
and `pkg/nordic_softdevice_ble/README-BLE-6LoWPAN.md` for more information on
|
||||
how to setup an IPv6 connection to your device.
|
||||
|
||||
For more features, you can use the SoftDevice with RIOTs `gnrc_networking`
|
||||
example application. Simply build `gnrc_networking` for a SoftDevice-capable
|
||||
device, e.g. `USEPKG=nordic_softdevice_ble BOARD=nrf52dk make ...`.
|
44
tests/nordic_softdevice/main.c
Normal file
44
tests/nordic_softdevice/main.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 This test application ensures that the Nordic SoftDevice
|
||||
* integration is included in the build test
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#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 Nordic SoftDevice");
|
||||
|
||||
/* 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;
|
||||
}
|
14
tests/nordic_softdevice/tests/01-run.py
Executable file
14
tests/nordic_softdevice/tests/01-run.py
Executable file
@ -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))
|
Loading…
Reference in New Issue
Block a user