From d73c1cc7c25d5e38d848f40598b17d84e77b6a5b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Sep 2016 05:20:53 +0200 Subject: timer_test: remove all random elements Change-Id: I9833031407e99f5d7a1144c26b68a7e320b2020d --- tests/timer/timer_test.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c index 461d0603..d8e1ec9b 100644 --- a/tests/timer/timer_test.c +++ b/tests/timer/timer_test.c @@ -93,7 +93,7 @@ static void main_timer_fired(void *data) osmo_gettimeofday(&v->start, NULL); v->timer.cb = secondary_timer_fired; v->timer.data = v; - unsigned int seconds = (random() % 10) + 1; + unsigned int seconds = (i & 0x7) + 1; v->stop.tv_sec = v->start.tv_sec + seconds; v->stop.tv_usec = v->start.tv_usec; osmo_timer_schedule(&v->timer, seconds, 0); @@ -111,6 +111,7 @@ static void secondary_timer_fired(void *data) struct test_timer *v = data, *this, *tmp; struct timeval current, res; struct timeval precision = { 0, TIME_BETWEEN_TIMER_CHECKS + 1}; + int i; osmo_gettimeofday(¤t, NULL); @@ -143,9 +144,11 @@ static void secondary_timer_fired(void *data) exit(EXIT_SUCCESS); } - /* randomly (10%) deletion of timers. */ + /* "random" deletion of timers. */ + i = 0; llist_for_each_entry_safe(this, tmp, &timer_test_list, head) { - if ((random() % 100) < 10) { + i ++; + if (!(i & 0x3)) { osmo_timer_del(&this->timer); llist_del(&this->head); talloc_free(this); -- cgit v1.2.3