From 0535a3244acc2a6c096703090b467e60e630cf60 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 9 Aug 2015 15:28:08 +0200 Subject: selftest: new binary - move selftest code from module/selftest to test/. - create a new binary called 'selftest' - the selftest is testing the Baresip Core only --- test/test.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/test.c (limited to 'test/test.c') diff --git a/test/test.c b/test/test.c new file mode 100644 index 0000000..ec6f6fb --- /dev/null +++ b/test/test.c @@ -0,0 +1,30 @@ +#include +#include +#include "test.h" + + +static void timeout_handler(void *arg) +{ + int *err = arg; + + warning("selftest: re_main() loop timed out -- test hung..\n"); + + *err = ETIMEDOUT; + + re_cancel(); +} + + +int re_main_timeout(uint32_t timeout) +{ + struct tmr tmr; + int err = 0; + + tmr_init(&tmr); + + tmr_start(&tmr, timeout * 1000, timeout_handler, &err); + re_main(NULL); + + tmr_cancel(&tmr); + return err; +} -- cgit v1.2.3