1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20909 from maribu/tests/net/gcoap_forward_proxy

tests/net: add stub test for gcoap_forward_proxy
This commit is contained in:
Martine Lenders 2024-10-14 14:50:56 +00:00 committed by GitHub
commit 5094f03f5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 111 additions and 2 deletions

View File

@ -236,7 +236,7 @@ static ssize_t _dispatch_msg(const void *buf, size_t len, sock_udp_ep_t *remote,
ssize_t res = gcoap_req_send(buf, len, remote, local, NULL, NULL,
GCOAP_SOCKET_TYPE_UDP);
if (res <= 0) {
DEBUG("gcoap_forward_proxy: unable to dispatch message: %d\n", -res);
DEBUG("gcoap_forward_proxy: unable to dispatch message: %d\n", (int)-res);
}
return res;
}
@ -353,7 +353,7 @@ static int _gcoap_forward_proxy_copy_options(coap_pkt_t *pkt,
bool uri_path_added = false;
bool etag_added = false;
for (int i = 0; i < client_pkt->options_len; i++) {
for (uint16_t i = 0; i < client_pkt->options_len; i++) {
ssize_t optlen = coap_opt_get_next(client_pkt, &opt, &value, !i);
/* wrt to ETag option slack: we always have at least the Proxy-URI option in the client_pkt,
* so we should hit at least once (and it's opt_num is also >= COAP_OPT_ETAG) */

View File

@ -0,0 +1,10 @@
include ../Makefile.net_common
USEMODULE += auto_init_gnrc_netif
USEMODULE += gcoap_forward_proxy
USEMODULE += gnrc_ipv6_default
USEMODULE += netdev_default
USEMODULE += shell
USEMODULE += shell_cmds_default
include $(RIOTBASE)/Makefile.include

View File

@ -0,0 +1,60 @@
BOARD_INSUFFICIENT_MEMORY := \
airfy-beacon \
arduino-duemilanove \
arduino-leonardo \
arduino-mega2560 \
arduino-nano \
arduino-uno \
atmega1284p \
atmega328p \
atmega328p-xplained-mini \
atmega8 \
atxmega-a3bu-xplained \
blackpill-stm32f103c8 \
bluepill-stm32f030c8 \
bluepill-stm32f103c8 \
calliope-mini \
derfmega128 \
hifive1 \
hifive1b \
i-nucleo-lrwan1 \
im880b \
mega-xplained \
microbit \
microduino-corerf \
msb-430 \
msb-430h \
nrf51dongle \
nrf6310 \
nucleo-c031c6 \
nucleo-f030r8 \
nucleo-f031k6 \
nucleo-f042k6 \
nucleo-f070rb \
nucleo-f072rb \
nucleo-f302r8 \
nucleo-f303k8 \
nucleo-f334r8 \
nucleo-l011k4 \
nucleo-l031k6 \
nucleo-l053r8 \
olimex-msp430-h1611 \
olimex-msp430-h2618 \
samd10-xmini \
saml10-xpro \
saml11-xpro \
slstk3400a \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \
stm32f7508-dk \
stm32g0316-disco \
stm32l0538-disco \
stm32mp157c-dk2 \
telosb \
waspmote-pro \
weact-g030f6 \
yunjia-nrf51822 \
z1 \
zigduino \
#

View File

@ -0,0 +1,5 @@
TODO
====
This application is here to ensure that the `gcoap_forward_proxy` is at least compile tested.
A proper test will hopefully be implemented some day that replaces this stub.

View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2024 ML!PA Consulting GmbH
*
* 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 application for the GCoAP forward proxy
*
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net>
* @}
*/
#include "msg.h"
#include "shell.h"
#define MAIN_QUEUE_SIZE (4)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
int main(void)
{
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;
}