diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/call.c | 6 | ||||
-rw-r--r-- | test/test.c | 13 | ||||
-rw-r--r-- | test/test.h | 2 | ||||
-rw-r--r-- | test/ua.c | 2 |
4 files changed, 15 insertions, 8 deletions
diff --git a/test/call.c b/test/call.c index 7ca1815..893b25e 100644 --- a/test/call.c +++ b/test/call.c @@ -181,7 +181,7 @@ int test_call_answer(void) TEST_ERR(err); /* run main-loop with timeout, wait for events */ - err = re_main_timeout(5); + err = re_main_timeout(5000); TEST_ERR(err); TEST_ERR(fix.err); @@ -215,7 +215,7 @@ int test_call_reject(void) TEST_ERR(err); /* run main-loop with timeout, wait for events */ - err = re_main_timeout(5); + err = re_main_timeout(5000); TEST_ERR(err); TEST_ERR(fix.err); @@ -248,7 +248,7 @@ int test_call_af_mismatch(void) TEST_ERR(err); /* run main-loop with timeout, wait for events */ - err = re_main_timeout(5); + err = re_main_timeout(5000); TEST_ERR(err); TEST_ERR(fix.err); diff --git a/test/test.c b/test/test.c index ec6f6fb..59e1cd1 100644 --- a/test/test.c +++ b/test/test.c @@ -15,15 +15,22 @@ static void timeout_handler(void *arg) } -int re_main_timeout(uint32_t timeout) +static void signal_handler(int sig) +{ + re_fprintf(stderr, "test interrupted by signal %d\n", sig); + re_cancel(); +} + + +int re_main_timeout(uint32_t timeout_ms) { struct tmr tmr; int err = 0; tmr_init(&tmr); - tmr_start(&tmr, timeout * 1000, timeout_handler, &err); - re_main(NULL); + tmr_start(&tmr, timeout_ms, timeout_handler, &err); + re_main(signal_handler); tmr_cancel(&tmr); return err; diff --git a/test/test.h b/test/test.h index 8aedc00..fc90989 100644 --- a/test/test.h +++ b/test/test.h @@ -46,7 +46,7 @@ /* helpers */ -int re_main_timeout(uint32_t timeout); +int re_main_timeout(uint32_t timeout_ms); #ifdef USE_TLS @@ -75,7 +75,7 @@ static int reg(enum sip_transp tp) goto out; /* run main-loop with timeout, wait for events */ - err = re_main_timeout(5); + err = re_main_timeout(5000); if (err) goto out; |