[MERGED] libosmocore[master]: fix timer_test: don't forget to set tv_usec on the stop time

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Sep 23 02:18:16 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: fix timer_test: don't forget to set tv_usec on the stop time
......................................................................


fix timer_test: don't forget to set tv_usec on the stop time

The timer_test schedules timers and records the desired stop time. Also store
the usec value of the desired stop time, because scheduling at e.g. sec N usec
999999 but recording sec N usec 0, and then receiving a timer at sec N+1 usec 0
is only 1 usec late, but records as 1000000 usecs late. This might have been
the main cause of the timer test not working well on the osmocom build server.

Change-Id: I13bb60f7d341a397f95d13d9c63c40188b6cd5a0
---
M tests/timer/timer_test.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c
index 6184f66..4981fd5 100644
--- a/tests/timer/timer_test.c
+++ b/tests/timer/timer_test.c
@@ -95,6 +95,7 @@
 		v->timer.data = v;
 		unsigned int seconds = (random() % 10) + 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);
 		llist_add(&v->head, &timer_test_list);
 	}

-- 
To view, visit https://gerrit.osmocom.org/882
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I13bb60f7d341a397f95d13d9c63c40188b6cd5a0
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list