diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-05-12 22:27:19 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-05-13 12:50:24 +0300 |
commit | 5f49cc35fdee36417a239f6c8dcc1181f8e6f3e9 (patch) | |
tree | c24bd8ea744ef65bbf2bc24c5477f78499de32a8 /test | |
parent | cc53ba882a26ec34d75681d9870d476e4b70e75b (diff) |
validation: timer: fix handle unused tmo
Current validation test can produce bug:
timer.c:250:handle_tmo():Wrong tick: expected 18446744073709551615 actual 149
FAILED
1. timer.c:246 - CU_FAIL("Wrong status (stale) for fresh timeout")
2. timer.c:251 - CU_FAIL("odp_timeout_tick() wrong tick")
Which caused with wrong destroy sequence:
timer_free() calls timer_cancel(tp, idx, TMO_UNUSED).
which is: ((uint64_t)0xFFFFFFFFFFFFFFFF) or 18446744073709551615
and test calls handle_tmo() for event with TMO_UNUSED.
To fix reoder destroy sequence odp_timer_cancel()->sleep()->handle_tmo()->
->odp_timer_free().
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/validation/timer/timer.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c index aad11aaaa..a39640579 100644 --- a/test/validation/timer/timer.c +++ b/test/validation/timer/timer.c @@ -397,8 +397,6 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) /* Cancel too late, timer already expired and * timeout enqueued */ nstale++; - if (odp_timer_free(tt[i].tim) != ODP_EVENT_INVALID) - CU_FAIL("odp_timer_free"); } LOG_DBG("Thread %u: %" PRIu32 " timers set\n", thr, nset); @@ -429,6 +427,12 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) break; } } + + for (i = 0; i < allocated; i++) { + if (odp_timer_free(tt[i].tim) != ODP_EVENT_INVALID) + CU_FAIL("odp_timer_free"); + } + /* Check if there any more (unexpected) events */ odp_event_t ev = odp_queue_deq(queue); if (ev != ODP_EVENT_INVALID) |