mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
test: unit: tcp: fix tcp state tests to not break other tests
On platform where check cannot fork (win32), the tcp_state tests crashed other tests. Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
parent
e29870c15e
commit
9672405eb9
@ -68,7 +68,9 @@ create_listening_pcb(u16_t local_port, struct test_tcp_counters *counters)
|
|||||||
return lpcb;
|
return lpcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setups/teardown functions */
|
/* Setup/teardown functions */
|
||||||
|
static struct netif* old_netif_list;
|
||||||
|
static struct netif* old_netif_default;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tcp_state_setup(void)
|
tcp_state_setup(void)
|
||||||
@ -82,16 +84,25 @@ tcp_state_setup(void)
|
|||||||
tcp_ticks = 0;
|
tcp_ticks = 0;
|
||||||
|
|
||||||
test_tcp_timer = 0;
|
test_tcp_timer = 0;
|
||||||
/* initialize local vars */
|
|
||||||
test_tcp_init_netif(&test_netif, &test_txcounters, &test_local_ip, &test_netmask);
|
old_netif_list = netif_list;
|
||||||
|
old_netif_default = netif_default;
|
||||||
|
netif_list = NULL;
|
||||||
|
netif_default = NULL;
|
||||||
tcp_remove_all();
|
tcp_remove_all();
|
||||||
|
test_tcp_init_netif(&test_netif, &test_txcounters, &test_local_ip, &test_netmask);
|
||||||
lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT));
|
lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tcp_state_teardown(void)
|
tcp_state_teardown(void)
|
||||||
{
|
{
|
||||||
|
netif_list = NULL;
|
||||||
|
netif_default = NULL;
|
||||||
tcp_remove_all();
|
tcp_remove_all();
|
||||||
|
/* restore netif_list for next tests (e.g. loopif) */
|
||||||
|
netif_list = old_netif_list;
|
||||||
|
netif_default = old_netif_default;
|
||||||
lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT));
|
lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user