[v4,3/3] test/event_crypto_adapter: free resources during exit

Message ID 20201008125234.22408-4-adwivedi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series Bug fixes in event crypto adapter test |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Ankur Dwivedi Oct. 8, 2020, 12:52 p.m. UTC
  The resources held by crypto adapter should be freed when the
test suite exits.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
---
 app/test/test_event_crypto_adapter.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
  

Patch

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 87a67139d..d6fbbfdde 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -899,6 +899,27 @@  testsuite_setup(void)
 	return TEST_SUCCESS;
 }
 
+static void
+crypto_adapter_teardown(void)
+{
+	int ret;
+
+	ret = rte_event_crypto_adapter_stop(TEST_ADAPTER_ID);
+	if (ret < 0)
+		RTE_LOG(ERR, USER1, "Failed to stop adapter!");
+
+	ret = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+					TEST_CDEV_ID, TEST_CDEV_QP_ID);
+	if (ret < 0)
+		RTE_LOG(ERR, USER1, "Failed to delete queue pair!");
+
+	ret = rte_event_crypto_adapter_free(TEST_ADAPTER_ID);
+	if (ret < 0)
+		RTE_LOG(ERR, USER1, "Failed to free adapter!");
+
+	crypto_adapter_setup_done = 0;
+}
+
 static void
 crypto_teardown(void)
 {
@@ -941,6 +962,7 @@  eventdev_teardown(void)
 static void
 testsuite_teardown(void)
 {
+	crypto_adapter_teardown();
 	crypto_teardown();
 	eventdev_teardown();
 }