fix compiling/running tests on win32

- new files
- different warning settings
- all tests run in a single process (no fork)
This commit is contained in:
Simon Goldschmidt 2021-05-21 22:00:49 +02:00
parent a8e8ce4108
commit bb5ee3783a
6 changed files with 31 additions and 5 deletions

View File

@ -84,6 +84,7 @@
<ClCompile Include="..\..\..\..\test\unit\api\test_sockets.c" /> <ClCompile Include="..\..\..\..\test\unit\api\test_sockets.c" />
<ClCompile Include="..\..\..\..\test\unit\arch\sys_arch.c" /> <ClCompile Include="..\..\..\..\test\unit\arch\sys_arch.c" />
<ClCompile Include="..\..\..\..\test\unit\core\test_def.c" /> <ClCompile Include="..\..\..\..\test\unit\core\test_def.c" />
<ClCompile Include="..\..\..\..\test\unit\core\test_dns.c" />
<ClCompile Include="..\..\..\..\test\unit\core\test_mem.c" /> <ClCompile Include="..\..\..\..\test\unit\core\test_mem.c" />
<ClCompile Include="..\..\..\..\test\unit\core\test_netif.c" /> <ClCompile Include="..\..\..\..\test\unit\core\test_netif.c" />
<ClCompile Include="..\..\..\..\test\unit\core\test_pbuf.c" /> <ClCompile Include="..\..\..\..\test\unit\core\test_pbuf.c" />
@ -104,6 +105,7 @@
<ClInclude Include="..\..\..\..\test\unit\api\test_sockets.h" /> <ClInclude Include="..\..\..\..\test\unit\api\test_sockets.h" />
<ClInclude Include="..\..\..\..\test\unit\arch\sys_arch.h" /> <ClInclude Include="..\..\..\..\test\unit\arch\sys_arch.h" />
<ClInclude Include="..\..\..\..\test\unit\core\test_def.h" /> <ClInclude Include="..\..\..\..\test\unit\core\test_def.h" />
<ClInclude Include="..\..\..\..\test\unit\core\test_dns.h" />
<ClInclude Include="..\..\..\..\test\unit\core\test_mem.h" /> <ClInclude Include="..\..\..\..\test\unit\core\test_mem.h" />
<ClInclude Include="..\..\..\..\test\unit\core\test_netif.h" /> <ClInclude Include="..\..\..\..\test\unit\core\test_netif.h" />
<ClInclude Include="..\..\..\..\test\unit\core\test_pbuf.h" /> <ClInclude Include="..\..\..\..\test\unit\core\test_pbuf.h" />

View File

@ -88,6 +88,9 @@
<ClCompile Include="..\..\..\..\test\unit\ip6\test_ip6.c"> <ClCompile Include="..\..\..\..\test\unit\ip6\test_ip6.c">
<Filter>ipv6</Filter> <Filter>ipv6</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\..\test\unit\core\test_dns.c">
<Filter>core</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\..\..\test\unit\core\test_mem.h"> <ClInclude Include="..\..\..\..\test\unit\core\test_mem.h">
@ -143,5 +146,8 @@
<ClInclude Include="..\..\..\..\test\unit\ip6\test_ip6.h"> <ClInclude Include="..\..\..\..\test\unit\ip6\test_ip6.h">
<Filter>ipv6</Filter> <Filter>ipv6</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\..\test\unit\core\test_dns.h">
<Filter>core</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -18,10 +18,11 @@ dns_teardown(void)
START_TEST(test_dns_set_get_server) START_TEST(test_dns_set_get_server)
{ {
int i; int n;
LWIP_UNUSED_ARG(_i); 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; ip_addr_t server;
/* Should return a zeroed address for any index */ /* Should return a zeroed address for any index */
fail_unless(dns_getserver(i)); fail_unless(dns_getserver(i));

View File

@ -99,9 +99,11 @@ END_TEST
/** Call pbuf_copy on pbufs with chains of different sizes */ /** Call pbuf_copy on pbufs with chains of different sizes */
START_TEST(test_pbuf_copy_unmatched_chains) START_TEST(test_pbuf_copy_unmatched_chains)
{ {
int i, j; uint16_t i, j;
err_t err; err_t err;
struct pbuf *source, *dest, *p; struct pbuf *source, *dest, *p;
LWIP_UNUSED_ARG(_i);
source = NULL; source = NULL;
/* Build source pbuf from linked 16 byte parts, /* Build source pbuf from linked 16 byte parts,
* with payload bytes containing their offset */ * 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); p = pbuf_alloc(PBUF_RAW, 16, PBUF_RAM);
fail_unless(p != NULL); fail_unless(p != NULL);
for (j = 0; j < p->len; j++) { 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) { if (source) {
pbuf_cat(source, p); pbuf_cat(source, p);

View File

@ -146,6 +146,8 @@ START_TEST(test_ip4_frag)
err_t err; err_t err;
LWIP_UNUSED_ARG(_i); LWIP_UNUSED_ARG(_i);
linkoutput_ctr = 0;
/* Verify that 8000 byte payload is split into six packets */ /* Verify that 8000 byte payload is split into six packets */
fail_unless(data != NULL); fail_unless(data != NULL);
test_netif_add(); test_netif_add();
@ -237,9 +239,10 @@ START_TEST(test_127_0_0_1)
{ {
ip4_addr_t localhost; ip4_addr_t localhost;
struct pbuf* p; struct pbuf* p;
LWIP_UNUSED_ARG(_i); LWIP_UNUSED_ARG(_i);
linkoutput_ctr = 0;
test_netif_add(); test_netif_add();
netif_set_down(netif_get_loopif()); netif_set_down(netif_get_loopif());
@ -279,6 +282,9 @@ START_TEST(test_ip4_icmp_replylen_short)
0xaa }; 0xaa };
struct pbuf *p; struct pbuf *p;
const int icmp_len = IP_HLEN + sizeof(struct icmp_hdr); const int icmp_len = IP_HLEN + sizeof(struct icmp_hdr);
LWIP_UNUSED_ARG(_i);
linkoutput_ctr = 0;
test_netif_add(); test_netif_add();
test_netif.output = arpless_output; test_netif.output = arpless_output;
@ -304,6 +310,9 @@ START_TEST(test_ip4_icmp_replylen_first_8)
struct pbuf *p; struct pbuf *p;
const int icmp_len = IP_HLEN + sizeof(struct icmp_hdr); const int icmp_len = IP_HLEN + sizeof(struct icmp_hdr);
const int unreach_len = IP_HLEN + 8; const int unreach_len = IP_HLEN + 8;
LWIP_UNUSED_ARG(_i);
linkoutput_ctr = 0;
test_netif_add(); test_netif_add();
test_netif.output = arpless_output; test_netif.output = arpless_output;

View File

@ -135,6 +135,8 @@ START_TEST(test_ip6_ll_addr)
{ {
LWIP_UNUSED_ARG(_i); LWIP_UNUSED_ARG(_i);
linkoutput_ctr = 0;
/* test without link-local address */ /* test without link-local address */
test_ip6_ll_addr_iter(0, 0); test_ip6_ll_addr_iter(0, 0);
@ -319,6 +321,8 @@ START_TEST(test_ip6_dest_unreachable_chained_pbuf)
u8_t *icmpptr; u8_t *icmpptr;
struct ip6_hdr *outhdr; struct ip6_hdr *outhdr;
struct icmp6_hdr *icmp6hdr; struct icmp6_hdr *icmp6hdr;
LWIP_UNUSED_ARG(_i);
fail_unless(header); fail_unless(header);
header->payload = udp_hdr; header->payload = udp_hdr;
fail_unless(data); fail_unless(data);
@ -363,6 +367,7 @@ START_TEST(test_ip6_frag_pbuf_len_assert)
struct pbuf *payload, *hdr; struct pbuf *payload, *hdr;
err_t err; err_t err;
int i; int i;
LWIP_UNUSED_ARG(_i);
/* Configure and enable local address */ /* Configure and enable local address */
test_netif6.mtu = 1500; 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); ip_addr_t peer_addr = IPADDR6_INIT_HOST(0x20010db8, 0x0, 0x0, 0x4);
struct pbuf *data; struct pbuf *data;
err_t err; err_t err;
LWIP_UNUSED_ARG(_i);
/* Configure and enable local address */ /* Configure and enable local address */
test_netif6.mtu = 1500; test_netif6.mtu = 1500;