summaryrefslogtreecommitdiffstats
path: root/tests/timer
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-22 05:20:53 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-22 07:18:39 +0200
commitd73c1cc7c25d5e38d848f40598b17d84e77b6a5b (patch)
tree212e8fd910bb5afaf8559abb020b088b08dcb616 /tests/timer
parent7b4d727ec5debc3d057686a0a3f0f5f14260a282 (diff)
timer_test: remove all random elements
Change-Id: I9833031407e99f5d7a1144c26b68a7e320b2020d
Diffstat (limited to 'tests/timer')
-rw-r--r--tests/timer/timer_test.c9
1 files 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(&current, 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);