diff mbox

[2/3] validation: pktio: destroy interface specific pools

Message ID 1424866561-3728-3-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit fdbd587b4db181a13b0eca6ed53c8ecc3cd21f45
Headers show

Commit Message

Stuart Haslam Feb. 25, 2015, 12:16 p.m. UTC
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 test/validation/odp_pktio.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

Comments

Maxim Uvarov Feb. 25, 2015, 12:34 p.m. UTC | #1
On 02/25/2015 03:16 PM, Stuart Haslam wrote:
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> ---
>   test/validation/odp_pktio.c | 23 +++++++++++++++++++++--
>   1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
> index 6bcec6c..effe059 100644
> --- a/test/validation/odp_pktio.c
> +++ b/test/validation/odp_pktio.c
> @@ -621,12 +621,31 @@ static int init_pktio_suite(void)
>   
>   static int term_pktio_suite(void)
>   {
> +	char pool_name[ODP_POOL_NAME_LEN];
> +	odp_pool_t pool;
> +	int i;
> +	int ret = 0;
> +
> +	for (i = 0; i < num_ifaces; ++i) {
> +		snprintf(pool_name, sizeof(pool_name),
> +			 "pkt_pool_%s", iface_name[i]);
> +		pool = odp_pool_lookup(pool_name);
> +		if (pool == ODP_POOL_INVALID)
> +			continue;
> +

> +		if (odp_pool_destroy(pool) != 0) {
> +			fprintf(stderr, "error: failed to destroy pool %s\n",
> +				pool_name);
Stuart, I think here is also good to add CU_ASSERT, not just a message. 
Also as in check bellow.

Maxim.
> +			ret = -1;
> +		}
> +	}
> +
>   	if (odp_pool_destroy(default_pkt_pool) != 0) {
>   		fprintf(stderr, "error: failed to destroy default pool\n");
> -		return -1;
> +		ret = -1;
>   	}
>   
> -	return 0;
> +	return ret;
>   }
>   
>   CU_TestInfo pktio_tests[] = {
Stuart Haslam Feb. 25, 2015, 12:52 p.m. UTC | #2
On Wed, Feb 25, 2015 at 03:34:07PM +0300, Maxim Uvarov wrote:
> On 02/25/2015 03:16 PM, Stuart Haslam wrote:
> >Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> >---
> >  test/validation/odp_pktio.c | 23 +++++++++++++++++++++--
> >  1 file changed, 21 insertions(+), 2 deletions(-)
> >
> >diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
> >index 6bcec6c..effe059 100644
> >--- a/test/validation/odp_pktio.c
> >+++ b/test/validation/odp_pktio.c
> >@@ -621,12 +621,31 @@ static int init_pktio_suite(void)
> >  static int term_pktio_suite(void)
> >  {
> >+	char pool_name[ODP_POOL_NAME_LEN];
> >+	odp_pool_t pool;
> >+	int i;
> >+	int ret = 0;
> >+
> >+	for (i = 0; i < num_ifaces; ++i) {
> >+		snprintf(pool_name, sizeof(pool_name),
> >+			 "pkt_pool_%s", iface_name[i]);
> >+		pool = odp_pool_lookup(pool_name);
> >+		if (pool == ODP_POOL_INVALID)
> >+			continue;
> >+
> 
> >+		if (odp_pool_destroy(pool) != 0) {
> >+			fprintf(stderr, "error: failed to destroy pool %s\n",
> >+				pool_name);
> Stuart, I think here is also good to add CU_ASSERT, not just a
> message. Also as in check bellow.
> 
> Maxim.

You can't use the CU_ macros in the suite init/term functions, only in
the test routines themselves.
diff mbox

Patch

diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 6bcec6c..effe059 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -621,12 +621,31 @@  static int init_pktio_suite(void)
 
 static int term_pktio_suite(void)
 {
+	char pool_name[ODP_POOL_NAME_LEN];
+	odp_pool_t pool;
+	int i;
+	int ret = 0;
+
+	for (i = 0; i < num_ifaces; ++i) {
+		snprintf(pool_name, sizeof(pool_name),
+			 "pkt_pool_%s", iface_name[i]);
+		pool = odp_pool_lookup(pool_name);
+		if (pool == ODP_POOL_INVALID)
+			continue;
+
+		if (odp_pool_destroy(pool) != 0) {
+			fprintf(stderr, "error: failed to destroy pool %s\n",
+				pool_name);
+			ret = -1;
+		}
+	}
+
 	if (odp_pool_destroy(default_pkt_pool) != 0) {
 		fprintf(stderr, "error: failed to destroy default pool\n");
-		return -1;
+		ret = -1;
 	}
 
-	return 0;
+	return ret;
 }
 
 CU_TestInfo pktio_tests[] = {