tcp unit tests: don't break later tests relying on loopif

This commit is contained in:
goldsimon 2017-03-17 08:56:03 +01:00
parent 3fd8440ab9
commit a42d1678eb
2 changed files with 19 additions and 1 deletions

View File

@ -29,10 +29,16 @@ test_tcp_tmr(void)
}
/* Setups/teardown functions */
static struct netif *old_netif_list;
static struct netif *old_netif_default;
static void
tcp_setup(void)
{
old_netif_list = netif_list;
old_netif_default = netif_default;
netif_list = NULL;
netif_default = NULL;
/* reset iss to default (6510) */
tcp_ticks = 0;
tcp_ticks = 0 - (tcp_next_iss(NULL) - 6510);
@ -49,6 +55,9 @@ tcp_teardown(void)
netif_list = NULL;
netif_default = NULL;
tcp_remove_all();
/* restore netif_list for next tests (e.g. loopif) */
netif_list = old_netif_list;
netif_default = old_netif_default;
}

View File

@ -118,19 +118,28 @@ tcp_oos_tcplen(struct tcp_pcb* pcb)
}
/* Setup/teardown functions */
static struct netif *old_netif_list;
static struct netif *old_netif_default;
static void
tcp_oos_setup(void)
{
old_netif_list = netif_list;
old_netif_default = netif_default;
netif_list = NULL;
netif_default = NULL;
tcp_remove_all();
}
static void
tcp_oos_teardown(void)
{
tcp_remove_all();
netif_list = NULL;
netif_default = NULL;
tcp_remove_all();
/* restore netif_list for next tests (e.g. loopif) */
netif_list = old_netif_list;
netif_default = old_netif_default;
}