Browse Source

tests: adapt lwip tests for v2.0.2's API

master
Martine Lenders 6 years ago
parent
commit
41eb29521f
No known key found for this signature in database
GPG Key ID: 8E97A9FE55F25D62
  1. 6
      tests/lwip_sock_ip/main.c
  2. 7
      tests/lwip_sock_ip/stack.c
  3. 6
      tests/lwip_sock_udp/main.c
  4. 5
      tests/lwip_sock_udp/stack.c

6
tests/lwip_sock_ip/main.c

@ -868,10 +868,8 @@ static void test_sock_ip_send6__EHOSTUNREACH(void)
static const sock_ip_ep_t remote = { .addr = { .ipv6 = _TEST_ADDR6_WRONG },
.family = AF_INET6 };
/* lwIP returns ENOMEM on failed neighbor cache lookup, since it "tries" to
* create one so we have to live with this weird behavior */
assert(-ENOMEM == sock_ip_send(NULL, "ABCD", sizeof("ABCD"), _TEST_PROTO,
&remote));
assert(-EHOSTUNREACH == sock_ip_send(NULL, "ABCD", sizeof("ABCD"), _TEST_PROTO,
&remote));
}
static void test_sock_ip_send6__ENOTCONN(void)

7
tests/lwip_sock_ip/stack.c

@ -27,6 +27,7 @@
#include "lwip/ip4.h"
#include "lwip/inet_chksum.h"
#include "lwip/nd6.h"
#include "lwip/priv/nd6_priv.h"
#include "lwip/netif.h"
#include "lwip/netif/netdev.h"
#include "lwip/tcpip.h"
@ -35,7 +36,7 @@
#include "constants.h"
#include "stack.h"
#define _MSG_QUEUE_SIZE (1)
#define _MSG_QUEUE_SIZE (4)
#define _SEND_DONE (0x92d7)
#define _NETDEV_BUFFER_SIZE (128)
@ -197,7 +198,9 @@ void _net_init(void)
static const uint8_t local6[] = _TEST_ADDR6_LOCAL;
s8_t idx;
netif_add_ip6_address(&netif, (ip6_addr_t *)&local6, &idx);
netif_ip6_addr_set_state(&netif, idx, IP6_ADDR_VALID);
for (int i = 0; i <= idx; i++) {
netif.ip6_addr_state[i] |= IP6_ADDR_VALID;
}
#endif
netif_set_default(&netif);
lwip_bootstrap();

6
tests/lwip_sock_udp/main.c

@ -995,10 +995,8 @@ static void test_sock_udp_send6__EHOSTUNREACH(void)
.family = AF_INET6,
.port = _TEST_PORT_REMOTE };
/* lwIP returns ENOMEM on failed neighbor cache lookup, since it "tries" to
* create one so we have to live with this weird behavior */
assert(-ENOMEM == sock_udp_send(NULL, "ABCD", sizeof("ABCD"),
&remote));
assert(-EHOSTUNREACH == sock_udp_send(NULL, "ABCD", sizeof("ABCD"),
&remote));
}
static void test_sock_udp_send6__EINVAL_port(void)

5
tests/lwip_sock_udp/stack.c

@ -28,6 +28,7 @@
#include "lwip/ip4.h"
#include "lwip/inet_chksum.h"
#include "lwip/nd6.h"
#include "lwip/priv/nd6_priv.h"
#include "lwip/netif.h"
#include "lwip/netif/netdev.h"
#include "lwip/opt.h"
@ -200,7 +201,9 @@ void _net_init(void)
static const uint8_t local6[] = _TEST_ADDR6_LOCAL;
s8_t idx;
netif_add_ip6_address(&netif, (ip6_addr_t *)&local6, &idx);
netif_ip6_addr_set_state(&netif, idx, IP6_ADDR_VALID);
for (int i = 0; i <= idx; i++) {
netif.ip6_addr_state[i] |= IP6_ADDR_VALID;
}
#endif
netif_set_default(&netif);
lwip_bootstrap();

Loading…
Cancel
Save