From bb5ee3783a37670fbf071dd97af422814f9b90cc Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Fri, 21 May 2021 22:00:49 +0200 Subject: [PATCH] fix compiling/running tests on win32 - new files - different warning settings - all tests run in a single process (no fork) --- contrib/ports/win32/msvc/lwip_unittests.vcxproj | 2 ++ .../ports/win32/msvc/lwip_unittests.vcxproj.filters | 6 ++++++ test/unit/core/test_dns.c | 5 +++-- test/unit/core/test_pbuf.c | 6 ++++-- test/unit/ip4/test_ip4.c | 11 ++++++++++- test/unit/ip6/test_ip6.c | 6 ++++++ 6 files changed, 31 insertions(+), 5 deletions(-) diff --git a/contrib/ports/win32/msvc/lwip_unittests.vcxproj b/contrib/ports/win32/msvc/lwip_unittests.vcxproj index f859eaf8..72bc948a 100644 --- a/contrib/ports/win32/msvc/lwip_unittests.vcxproj +++ b/contrib/ports/win32/msvc/lwip_unittests.vcxproj @@ -84,6 +84,7 @@ + @@ -104,6 +105,7 @@ + diff --git a/contrib/ports/win32/msvc/lwip_unittests.vcxproj.filters b/contrib/ports/win32/msvc/lwip_unittests.vcxproj.filters index 09455da9..dbf1a4c1 100644 --- a/contrib/ports/win32/msvc/lwip_unittests.vcxproj.filters +++ b/contrib/ports/win32/msvc/lwip_unittests.vcxproj.filters @@ -88,6 +88,9 @@ ipv6 + + core + @@ -143,5 +146,8 @@ ipv6 + + core + \ No newline at end of file diff --git a/test/unit/core/test_dns.c b/test/unit/core/test_dns.c index d5582796..6789d244 100644 --- a/test/unit/core/test_dns.c +++ b/test/unit/core/test_dns.c @@ -18,10 +18,11 @@ dns_teardown(void) START_TEST(test_dns_set_get_server) { - int i; + int n; LWIP_UNUSED_ARG(_i); - for (i = 0; i < 256; i++) { + for (n = 0; n < 256; n++) { + u8_t i = (u8_t)n; ip_addr_t server; /* Should return a zeroed address for any index */ fail_unless(dns_getserver(i)); diff --git a/test/unit/core/test_pbuf.c b/test/unit/core/test_pbuf.c index 681d61dc..6163e4fa 100644 --- a/test/unit/core/test_pbuf.c +++ b/test/unit/core/test_pbuf.c @@ -99,9 +99,11 @@ END_TEST /** Call pbuf_copy on pbufs with chains of different sizes */ START_TEST(test_pbuf_copy_unmatched_chains) { - int i, j; + uint16_t i, j; err_t err; struct pbuf *source, *dest, *p; + LWIP_UNUSED_ARG(_i); + source = NULL; /* Build source pbuf from linked 16 byte parts, * with payload bytes containing their offset */ @@ -109,7 +111,7 @@ START_TEST(test_pbuf_copy_unmatched_chains) p = pbuf_alloc(PBUF_RAW, 16, PBUF_RAM); fail_unless(p != NULL); for (j = 0; j < p->len; j++) { - ((unsigned char*)p->payload)[j] = (i << 4) | j; + ((u8_t*)p->payload)[j] = (u8_t)((i << 4) | j); } if (source) { pbuf_cat(source, p); diff --git a/test/unit/ip4/test_ip4.c b/test/unit/ip4/test_ip4.c index 5e74c1ea..af715daf 100644 --- a/test/unit/ip4/test_ip4.c +++ b/test/unit/ip4/test_ip4.c @@ -146,6 +146,8 @@ START_TEST(test_ip4_frag) err_t err; LWIP_UNUSED_ARG(_i); + linkoutput_ctr = 0; + /* Verify that 8000 byte payload is split into six packets */ fail_unless(data != NULL); test_netif_add(); @@ -237,9 +239,10 @@ START_TEST(test_127_0_0_1) { ip4_addr_t localhost; struct pbuf* p; - LWIP_UNUSED_ARG(_i); + linkoutput_ctr = 0; + test_netif_add(); netif_set_down(netif_get_loopif()); @@ -279,6 +282,9 @@ START_TEST(test_ip4_icmp_replylen_short) 0xaa }; struct pbuf *p; const int icmp_len = IP_HLEN + sizeof(struct icmp_hdr); + LWIP_UNUSED_ARG(_i); + + linkoutput_ctr = 0; test_netif_add(); test_netif.output = arpless_output; @@ -304,6 +310,9 @@ START_TEST(test_ip4_icmp_replylen_first_8) struct pbuf *p; const int icmp_len = IP_HLEN + sizeof(struct icmp_hdr); const int unreach_len = IP_HLEN + 8; + LWIP_UNUSED_ARG(_i); + + linkoutput_ctr = 0; test_netif_add(); test_netif.output = arpless_output; diff --git a/test/unit/ip6/test_ip6.c b/test/unit/ip6/test_ip6.c index e1900af3..43ffcf78 100644 --- a/test/unit/ip6/test_ip6.c +++ b/test/unit/ip6/test_ip6.c @@ -135,6 +135,8 @@ START_TEST(test_ip6_ll_addr) { LWIP_UNUSED_ARG(_i); + linkoutput_ctr = 0; + /* test without link-local address */ test_ip6_ll_addr_iter(0, 0); @@ -319,6 +321,8 @@ START_TEST(test_ip6_dest_unreachable_chained_pbuf) u8_t *icmpptr; struct ip6_hdr *outhdr; struct icmp6_hdr *icmp6hdr; + LWIP_UNUSED_ARG(_i); + fail_unless(header); header->payload = udp_hdr; fail_unless(data); @@ -363,6 +367,7 @@ START_TEST(test_ip6_frag_pbuf_len_assert) struct pbuf *payload, *hdr; err_t err; int i; + LWIP_UNUSED_ARG(_i); /* Configure and enable local address */ test_netif6.mtu = 1500; @@ -403,6 +408,7 @@ START_TEST(test_ip6_frag) ip_addr_t peer_addr = IPADDR6_INIT_HOST(0x20010db8, 0x0, 0x0, 0x4); struct pbuf *data; err_t err; + LWIP_UNUSED_ARG(_i); /* Configure and enable local address */ test_netif6.mtu = 1500;