diff mbox

validation: odp_timer: cleanup for clean termination

Message ID 1425501464-10035-1-git-send-email-ola.liljedahl@linaro.org
State Accepted
Commit fef341532aac890b6af15b044a308c998ed29fd7
Headers show

Commit Message

Ola Liljedahl March 4, 2015, 8:37 p.m. UTC
Free queue and timeouts, destroy timeout pool before termination.
https://cards.linaro.org/browse/LNG-831
https://bugs.linaro.org/show_bug.cgi?id=1285

Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
---
(This document/code contribution attached is provided under the terms of
agreement LES-LTM-21309)

 test/validation/odp_timer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Mike Holmes March 4, 2015, 10:41 p.m. UTC | #1
On 4 March 2015 at 15:37, Ola Liljedahl <ola.liljedahl@linaro.org> wrote:

> Free queue and timeouts, destroy timeout pool before termination.
> https://cards.linaro.org/browse/LNG-831


No need to reference the CARD in the git repo commit message because it is
not public anyway, it could go after the sign off if it helps our process.


>
> https://bugs.linaro.org/show_bug.cgi?id=1285
>
> Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>

---
> (This document/code contribution attached is provided under the terms of
> agreement LES-LTM-21309)
>
>  test/validation/odp_timer.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> index 88af61b..3e83367 100644
> --- a/test/validation/odp_timer.c
> +++ b/test/validation/odp_timer.c
> @@ -336,6 +336,11 @@ static void *worker_entrypoint(void *arg)
>         if (ev != ODP_EVENT_INVALID)
>                 CU_FAIL("Unexpected event received");
>
> +       odp_queue_destroy(queue);
>

We need to test the return code for odp_queue_destroy here with a CU assert.


> +       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;
>  }
> @@ -426,6 +431,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 */
> +       int rc = odp_pool_destroy(tbp);
> +       CU_ASSERT(rc == 0);
> +
>         CU_PASS("ODP timer test");

 }
>
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 88af61b..3e83367 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -336,6 +336,11 @@  static void *worker_entrypoint(void *arg)
 	if (ev != ODP_EVENT_INVALID)
 		CU_FAIL("Unexpected event received");
 
+	odp_queue_destroy(queue);
+	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;
 }
@@ -426,6 +431,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 */
+	int rc = odp_pool_destroy(tbp);
+	CU_ASSERT(rc == 0);
+
 	CU_PASS("ODP timer test");
 }