summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-02-14 12:42:14 +0100
committerAlfred E. Heggestad <aeh@db.org>2016-02-14 12:42:14 +0100
commitbcc02dc4019b6d4afd744bc06e6764687a7af8b5 (patch)
tree51bf3253694c5058b252e5d29cd801f2edb431f9 /test
parent7c8862398d184d8735b718145a75bb0dd5e650f0 (diff)
test: use milliseconds for re_main_timeout value
Diffstat (limited to 'test')
-rw-r--r--test/call.c6
-rw-r--r--test/test.c13
-rw-r--r--test/test.h2
-rw-r--r--test/ua.c2
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
diff --git a/test/ua.c b/test/ua.c
index e5cc382..c039705 100644
--- a/test/ua.c
+++ b/test/ua.c
@@ -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;