DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dan Gora <dg@adax.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Dan Gora <dg@adax.com>
Subject: [dpdk-dev] [PATCH 07/10] kni: update kni test for rte_kni_free
Date: Thu, 28 Jun 2018 15:53:50 -0700	[thread overview]
Message-ID: <20180628225350.21227-1-dg@adax.com> (raw)

Add support for testing rte_kni_free() function.

Signed-off-by: Dan Gora <dg@adax.com>
---
 test/test/test_kni.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index 56773c8a2..ec051c07e 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -427,6 +427,12 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		goto fail_kni;
 	}
 
+	/* test of freeing an unreleased kni device */
+	if (rte_kni_free(kni) == 0) {
+		printf("should not be able to free an unreleased kni device\n");
+		return -1;
+	}
+
 	if (rte_kni_release(kni) < 0) {
 		printf("fail to release kni\n");
 		return -1;
@@ -439,6 +445,12 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 		return -1;
 	}
 
+	/* test of freeing a released kni device */
+	if (rte_kni_free(kni) != 0) {
+		printf("failed to free a released kni device\n");
+		return -1;
+	}
+
 	/* test of reusing memzone */
 	kni = rte_kni_alloc(mp, &conf, &ops);
 	if (!kni) {
@@ -598,6 +610,14 @@ test_kni(void)
 		goto fail;
 	}
 
+	/* test of freeing NULL kni context */
+	ret = rte_kni_free(NULL);
+	if (ret == 0) {
+		ret = -1;
+		printf("unexpectedly freed kni successfully\n");
+		goto fail;
+	}
+
 	/* test of handling request on NULL device pointer */
 	ret = rte_kni_handle_request(NULL);
 	if (ret == 0) {
-- 
2.18.0.rc1.1.g6f333ff2f

                 reply	other threads:[~2018-06-28 22:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628225350.21227-1-dg@adax.com \
    --to=dg@adax.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).