aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOla Liljedahl <ola.liljedahl@linaro.org>2015-03-09 12:28:03 +0100
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-03-10 12:54:03 +0300
commit111a1b50b4de2f8838f4bd33042e8e738a6ecac1 (patch)
tree91ac952143bd8c54f7de72f3c5a100940501af95 /test
parentccee7efcf3eb30a5b2dd6dc53c689a8d41a81cdc (diff)
validation: odp_timer: cleanup for clean termination
Free queue and timeouts, destroy timeout pool before termination. https://bugs.linaro.org/show_bug.cgi?id=1285 Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'test')
-rw-r--r--test/validation/odp_timer.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 88af61b74..b625b80ee 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -188,6 +188,7 @@ static void *worker_entrypoint(void *arg)
int thr = odp_thread_id();
uint32_t i;
unsigned seed = thr;
+ int rc;
(void)arg;
odp_queue_t queue = odp_queue_create("timer_queue",
@@ -251,7 +252,7 @@ static void *worker_entrypoint(void *arg)
if (tt[i].ev == ODP_EVENT_INVALID &&
(rand_r(&seed) % 2 == 0)) {
/* Timer active, cancel it */
- int rc = odp_timer_cancel(tt[i].tim, &tt[i].ev);
+ rc = odp_timer_cancel(tt[i].tim, &tt[i].ev);
if (rc != 0)
/* Cancel failed, timer already expired */
ntoolate++;
@@ -336,6 +337,12 @@ static void *worker_entrypoint(void *arg)
if (ev != ODP_EVENT_INVALID)
CU_FAIL("Unexpected event received");
+ rc = odp_queue_destroy(queue);
+ CU_ASSERT(rc == 0);
+ for (i = 0; i < NTIMERS; i++) {
+ if (tt[i].ev != ODP_EVENT_INVALID)
+ odp_timeout_free(odp_timeout_from_event(tt[i].ev));
+ }
LOG_DBG("Thread %u: exiting\n", thr);
return NULL;
}
@@ -343,6 +350,7 @@ static void *worker_entrypoint(void *arg)
/* @private Timer test case entrypoint */
static void test_odp_timer_all(void)
{
+ int rc;
odp_pool_param_t params;
odp_timer_pool_param_t tparam;
/* Reserve at least one core for running other processes so the timer
@@ -426,6 +434,10 @@ static void test_odp_timer_all(void)
/* Destroy timer pool, all timers must have been freed */
odp_timer_pool_destroy(tp);
+ /* Destroy timeout pool, all timeouts must have been freed */
+ rc = odp_pool_destroy(tbp);
+ CU_ASSERT(rc == 0);
+
CU_PASS("ODP timer test");
}