Start implementing unit tests for timers

This commit is contained in:
Dirk Ziegelmeier
2018-01-04 13:37:05 +01:00
parent 40fecab313
commit 756b7431a7
9 changed files with 116 additions and 7 deletions

View File

@@ -113,6 +113,14 @@ const int lwip_num_cyclic_timers = LWIP_ARRAYSIZE(lwip_cyclic_timers);
static struct sys_timeo *next_timeout;
static u32_t timeouts_last_time;
#if LWIP_TESTMODE
struct sys_timeo**
lwip_sys_timers_get_next_timout(void)
{
return &next_timeout;
}
#endif
#if LWIP_TCP
/** global variable that shows if the tcp timer is currently scheduled or not */
static int tcpip_tcp_timer_active;
@@ -313,7 +321,7 @@ sys_untimeout(sys_timeout_handler handler, void *arg)
*
* Must be called periodically from your main loop.
*/
#if !NO_SYS && !defined __DOXYGEN__
#if !LWIP_TESTMODE && !NO_SYS && !defined __DOXYGEN__
static
#endif /* !NO_SYS */
void
@@ -377,7 +385,7 @@ sys_restart_timeouts(void)
/** Return the time left before the next timeout is due. If no timeouts are
* enqueued, returns 0xffffffff
*/
#if !NO_SYS
#if !LWIP_TESTMODE && !NO_SYS
static
#endif /* !NO_SYS */
u32_t

View File

@@ -106,13 +106,17 @@ void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg);
void sys_untimeout(sys_timeout_handler handler, void *arg);
void sys_restart_timeouts(void);
#if NO_SYS
#if LWIP_TESTMODE || NO_SYS
void sys_check_timeouts(void);
u32_t sys_timeouts_sleeptime(void);
#else /* NO_SYS */
#endif
#if !NO_SYS
void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg);
#endif /* NO_SYS */
#if LWIP_TESTMODE
struct sys_timeo** lwip_sys_timers_get_next_timout(void);
#endif
#endif /* LWIP_TIMERS */