[v1,1/3] validation: timer: fix "Failed to set timer" error

Message ID 1519146008-3368-2-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series
  • [v1,1/3] validation: timer: fix "Failed to set timer" error
Related show

Commit Message

Github ODP bot Feb. 20, 2018, 5 p.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Occasionally timer test will try to set timer to a tick that has just
passed. It is not an error per se, so it should be handled properly.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

Fixes: https://bugs.linaro.org/show_bug.cgi?id=3628
---
/** Email created from pull request 491 (lumag:timer-fix-2)
 ** https://github.com/Linaro/odp/pull/491
 ** Patch: https://github.com/Linaro/odp/pull/491.patch
 ** Base sha: d5419e8857b2bc61d3be17fe53f171550fee426b
 ** Merge commit sha: 1623e4e7c0742c5238c1b97abe1e8af93f091443
 **/
 test/validation/api/timer/timer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c
index 7ea508aa0..c3b807aee 100644
--- a/test/validation/api/timer/timer.c
+++ b/test/validation/api/timer/timer.c
@@ -373,7 +373,10 @@  static int worker_entrypoint(void *arg TEST_UNUSED)
 		      odp_timer_ns_to_tick(tp, (rand_r(&seed) % RANGE_MS)
 					       * 1000000ULL);
 		timer_rc = odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev);
-		if (timer_rc != ODP_TIMER_SUCCESS) {
+		if (timer_rc == ODP_TIMER_TOOEARLY) {
+			LOG_ERR("Missed tick, setting timer\n");
+		} else if (timer_rc != ODP_TIMER_SUCCESS) {
+			LOG_ERR("Failed to set timer: %d\n", timer_rc);
 			CU_FAIL("Failed to set timer");
 		} else {
 			tt[i].tick = tck;