From: Dmitry Eremin-Solenikov <dmitry.ereminsoleni...@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.ereminsoleni...@linaro.org>
---
/** Email created from pull request 479 (lumag:timer-fix)
 ** https://github.com/Linaro/odp/pull/479
 ** Patch: https://github.com/Linaro/odp/pull/479.patch
 ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847
 ** Merge commit sha: eff72e496790b8e924e3fceaea22548fa28241b8
 **/
 test/validation/api/timer/timer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/validation/api/timer/timer.c 
b/test/validation/api/timer/timer.c
index da2dc05ca..0dfb565e2 100644
--- a/test/validation/api/timer/timer.c
+++ b/test/validation/api/timer/timer.c
@@ -386,7 +386,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;

Reply via email to