1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

tests/lwip: Update test to match new ifconfig

Removed custom ifconfig command.
This commit is contained in:
Erik Ekman 2021-02-12 12:20:16 +01:00
parent eab317749f
commit 88d2d2d030
2 changed files with 4 additions and 40 deletions

View File

@ -32,43 +32,6 @@
#endif
#include "shell.h"
#define IFCONFIG_FILLER " "
static int ifconfig(int argc, char **argv)
{
(void)argc;
(void)argv;
for (struct netif *iface = netif_list; iface != NULL; iface = iface->next) {
printf("%s_%02u: ", iface->name, iface->num);
#if IS_USED(MODULE_LWIP_IPV6)
char addrstr[IPV6_ADDR_MAX_STR_LEN];
#elif IS_USED(MODULE_LWIP_IPV4)
char addrstr[IPV4_ADDR_MAX_STR_LEN];
#endif
#ifdef MODULE_LWIP_IPV6
for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
if (!ipv6_addr_is_unspecified((ipv6_addr_t *)&iface->ip6_addr[i])) {
printf("%s inet6 %s\n", (i == 0) ? "" : IFCONFIG_FILLER,
ipv6_addr_to_str(addrstr,
(ipv6_addr_t *)&iface->ip6_addr[i],
sizeof(addrstr)));
}
}
#endif
#ifdef MODULE_LWIP_IPV4
if (IS_USED(MODULE_LWIP_IPV6)) {
/* insert spaces to be aligned with inet6 */
printf(IFCONFIG_FILLER);
}
printf(" inet %s\n", ipv4_addr_to_str(addrstr,
(ipv4_addr_t *)&iface->ip_addr,
sizeof(addrstr)));
#endif
puts("");
}
return 0;
}
static const shell_command_t shell_commands[] = {
#ifdef MODULE_SOCK_IP
{ "ip", "Send IP packets and listen for packets of certain type", ip_cmd },
@ -79,7 +42,6 @@ static const shell_command_t shell_commands[] = {
#ifdef MODULE_SOCK_UDP
{ "udp", "Send UDP messages and listen for messages on UDP port", udp_cmd },
#endif
{ "ifconfig", "Shows assigned IP addresses", ifconfig },
{ NULL, NULL, NULL }
};

View File

@ -15,6 +15,7 @@ import time
import types
import pexpect
import socket
import ipaddress
DEFAULT_TIMEOUT = 5
@ -190,8 +191,9 @@ class TestStrategy(ApplicationStrategy):
def get_ipv6_address(spawn):
spawn.sendline(u"ifconfig")
spawn.expect(r"[A-Za-z0-9]{2}_[0-9]+: inet6 (fe80::[0-9a-f:]+)\s")
return spawn.match.group(1)
spawn.expect(r" inet6 addr: (fe80:[0-9a-f:]+)\s")
# pack v6 address to minimal form (lwIP returns fe80:0:0:..)
return str(ipaddress.ip_address(spawn.match.group(1)))
def test_ipv6_send(board_group, application, env=None):