DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework
@ 2021-04-02 14:24 Ciara Power
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner Ciara Power
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Ciara Power @ 2021-04-02 14:24 UTC (permalink / raw)
  To: dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Ciara Power

v2:
  - Added macro in place of testcase/testsuite loops.
  - Added more detail in the summary output.
  - Moved testcase counts to the testsuite structure.
  - Flattened testsuite structure to remove union.
  - Added patch for fix of blockcipher test return value.
  - Squashed release note into last patch.

The current crypto unit test framework is not granular enough to
accurately track unit test results. This is caused by one testcase
in a suite actually running multiple testcases, but only returning
one result.
 
The approach taken in this patchset allows a test suite have either a
list of sub-testsuites, or a list of testcases as previously used.
The unit test suite runner can then recursively iterate and run the
sub-testsuites, until it reaches a suite with testcases,
and it then runs each testcase as it had done previously.
 
By allowing this further breakdown into sub-testsuites,
a refactor of the crypto unit tests solves the issue of inaccurate
reporting, as sub-testsuites can be used in place of the testcases
that had multiple testcases hidden on a sub level.
The blockcipher tests previously had these hidden testcases,
but are now sub-testsuites that are dynamically created and added to a
parent test suite, allowing for each testcase status to be reported
directly to the runner.
The cryptodev test suite is broken down into smaller suites that are
used as sub-testsuites, which allows for more flexibility choosing which
sub-testsuites should run for the current device autotest.
The introduction of sub-testsuites also allows for more precise
setup/teardown functions, rather than general ones loaded with
conditions as was seen with the initial setup function used for all
crypto testsuites.
 
For example, when running the cryptodev_aesni_mb_autotest, 
the AESNI MB parent test suite has its own setup function to initialise
the AESNI MB device.
Various sub-testsuites are added to the parent test suite, such as some
of the static suites that were once in the cryptodev_testsuite,
and blockcipher suites.
The unit test runner can then run the AESNI MB parent test suite,
which in turn will run the sub-testsuites.
 
Documentation will be added in a later version of the patchset,
adding to the test document that isn't yet merged. [1]

---
[1] https://patchwork.dpdk.org/project/dpdk/patch/20210309155757.615536-1-aconole@redhat.com/

Ciara Power (6):
  app/test: refactor of unit test suite runner
  test: introduce parent testsuite format
  test/crypto: refactor to use sub-testsuites
  test/crypto: move testsuite params to header file
  test/crypto: fix return value on test skipped
  test/crypto: dynamically build blockcipher suite

 app/test/test.c                        |  226 ++-
 app/test/test.h                        |   23 +-
 app/test/test_cryptodev.c              | 1964 ++++++++++++++++++------
 app/test/test_cryptodev.h              |   20 +
 app/test/test_cryptodev_asym.c         |   93 +-
 app/test/test_cryptodev_blockcipher.c  |  127 +-
 app/test/test_cryptodev_blockcipher.h  |   12 +-
 app/test/test_ipsec.c                  |   32 +-
 doc/guides/rel_notes/release_21_05.rst |    5 +
 9 files changed, 1831 insertions(+), 671 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner
  2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
@ 2021-04-02 14:24 ` Ciara Power
  2021-04-05 12:10   ` Aaron Conole
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format Ciara Power
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Ciara Power @ 2021-04-02 14:24 UTC (permalink / raw)
  To: dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Ciara Power

Some small changes were made to the unit test suite runner for
readability and to enable reuse of some of the function in a later patch.

On test suite setup skip/fail, the loop to count testcases as
skipped/failed has been moved to another function.
This will allow for recursion in a later patch when nested sub-testsuites
are used.

The unit test suite runner accessed the list of testcases in the suite
structure every time the testcase was used. This is now replaced by a
testcase variable which improves readability.

A macro has been introduced for readability, instead of using open
coded loops.

Rather than keep local variable status counts for testcases,
these are added to the test suite structure.

The summary output now prints the suite name, this will be useful later
when multiple nested sub-testsuites are being run.

Signed-off-by: Ciara Power <ciara.power@intel.com>

---
v2:
  - Added macro to loop testcases in suite.
  - Testcase counts added to the test suite structure.
---
 app/test/test.c | 101 +++++++++++++++++++++++++++++-------------------
 app/test/test.h |   6 +++
 2 files changed, 67 insertions(+), 40 deletions(-)

diff --git a/app/test/test.c b/app/test/test.c
index 624dd48042..a795cba1bb 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -36,6 +36,11 @@ extern cmdline_parse_ctx_t main_ctx[];
 
 #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
 
+#define FOR_EACH_SUITE_TESTCASE(iter, suite, case)			\
+	for (iter = 0, case = suite->unit_test_cases[0];		\
+		suite->unit_test_cases[iter].testcase;			\
+		iter++, case = suite->unit_test_cases[iter])
+
 const char *prgname; /* to be set to argv[0] */
 
 static const char *recursive_call; /* used in linux for MP and other tests */
@@ -207,14 +212,39 @@ main(int argc, char **argv)
 	return ret;
 }
 
+static void
+unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite,
+		int test_success)
+{
+	struct unit_test_case tc;
+
+	FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
+		if (!tc.enabled || test_success == TEST_SKIPPED)
+			suite->skipped++;
+		else
+			suite->failed++;
+	}
+}
+
+static void
+unit_test_suite_reset_counts(struct unit_test_suite *suite)
+{
+	suite->total = 0;
+	suite->executed = 0;
+	suite->succeeded = 0;
+	suite->skipped = 0;
+	suite->failed = 0;
+	suite->unsupported = 0;
+}
 
 int
 unit_test_suite_runner(struct unit_test_suite *suite)
 {
 	int test_success;
-	unsigned int total = 0, executed = 0, skipped = 0;
-	unsigned int succeeded = 0, failed = 0, unsupported = 0;
 	const char *status;
+	struct unit_test_case tc;
+
+	unit_test_suite_reset_counts(suite);
 
 	if (suite->suite_name) {
 		printf(" + ------------------------------------------------------- +\n");
@@ -228,55 +258,48 @@ unit_test_suite_runner(struct unit_test_suite *suite)
 			 * setup did not pass, so count all enabled tests and
 			 * mark them as failed/skipped
 			 */
-			while (suite->unit_test_cases[total].testcase) {
-				if (!suite->unit_test_cases[total].enabled ||
-				    test_success == TEST_SKIPPED)
-					skipped++;
-				else
-					failed++;
-				total++;
-			}
+			unit_test_suite_count_tcs_on_setup_fail(suite,
+					test_success);
 			goto suite_summary;
 		}
 	}
 
 	printf(" + ------------------------------------------------------- +\n");
 
-	while (suite->unit_test_cases[total].testcase) {
-		if (!suite->unit_test_cases[total].enabled) {
-			skipped++;
-			total++;
+	FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
+		if (!tc.enabled) {
+			suite->skipped++;
 			continue;
 		} else {
-			executed++;
+			suite->executed++;
 		}
 
 		/* run test case setup */
-		if (suite->unit_test_cases[total].setup)
-			test_success = suite->unit_test_cases[total].setup();
+		if (tc.setup)
+			test_success = tc.setup();
 		else
 			test_success = TEST_SUCCESS;
 
 		if (test_success == TEST_SUCCESS) {
 			/* run the test case */
-			test_success = suite->unit_test_cases[total].testcase();
+			test_success = tc.testcase();
 			if (test_success == TEST_SUCCESS)
-				succeeded++;
+				suite->succeeded++;
 			else if (test_success == TEST_SKIPPED)
-				skipped++;
+				suite->skipped++;
 			else if (test_success == -ENOTSUP)
-				unsupported++;
+				suite->unsupported++;
 			else
-				failed++;
+				suite->failed++;
 		} else if (test_success == -ENOTSUP) {
-			unsupported++;
+			suite->unsupported++;
 		} else {
-			failed++;
+			suite->failed++;
 		}
 
 		/* run the test case teardown */
-		if (suite->unit_test_cases[total].teardown)
-			suite->unit_test_cases[total].teardown();
+		if (tc.teardown)
+			tc.teardown();
 
 		if (test_success == TEST_SUCCESS)
 			status = "succeeded";
@@ -287,10 +310,8 @@ unit_test_suite_runner(struct unit_test_suite *suite)
 		else
 			status = "failed";
 
-		printf(" + TestCase [%2d] : %s %s\n", total,
-				suite->unit_test_cases[total].name, status);
-
-		total++;
+		printf(" + TestCase [%2d] : %s %s\n", suite->total,
+				tc.name, status);
 	}
 
 	/* Run test suite teardown */
@@ -301,20 +322,20 @@ unit_test_suite_runner(struct unit_test_suite *suite)
 
 suite_summary:
 	printf(" + ------------------------------------------------------- +\n");
-	printf(" + Test Suite Summary \n");
-	printf(" + Tests Total :       %2d\n", total);
-	printf(" + Tests Skipped :     %2d\n", skipped);
-	printf(" + Tests Executed :    %2d\n", executed);
-	printf(" + Tests Unsupported:  %2d\n", unsupported);
-	printf(" + Tests Passed :      %2d\n", succeeded);
-	printf(" + Tests Failed :      %2d\n", failed);
+	printf(" + Test Suite Summary : %s\n", suite->suite_name);
+	printf(" + Tests Total :       %2d\n", suite->total);
+	printf(" + Tests Skipped :     %2d\n", suite->skipped);
+	printf(" + Tests Executed :    %2d\n", suite->executed);
+	printf(" + Tests Unsupported:  %2d\n", suite->unsupported);
+	printf(" + Tests Passed :      %2d\n", suite->succeeded);
+	printf(" + Tests Failed :      %2d\n", suite->failed);
 	printf(" + ------------------------------------------------------- +\n");
 
-	last_test_result = failed;
+	last_test_result = suite->failed;
 
-	if (failed)
+	if (suite->failed)
 		return TEST_FAILED;
-	if (total == skipped)
+	if (suite->total == suite->skipped)
 		return TEST_SKIPPED;
 	return TEST_SUCCESS;
 }
diff --git a/app/test/test.h b/app/test/test.h
index b07f6c1ef0..10c7b496e6 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -138,6 +138,12 @@ struct unit_test_suite {
 	const char *suite_name;
 	int (*setup)(void);
 	void (*teardown)(void);
+	unsigned int total;
+	unsigned int executed;
+	unsigned int succeeded;
+	unsigned int skipped;
+	unsigned int failed;
+	unsigned int unsupported;
 	struct unit_test_case unit_test_cases[];
 };
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format
  2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner Ciara Power
@ 2021-04-02 14:24 ` Ciara Power
  2021-04-05 12:30   ` Aaron Conole
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites Ciara Power
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Ciara Power @ 2021-04-02 14:24 UTC (permalink / raw)
  To: dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Ciara Power

The current structure for unit testing only allows for running a
test suite with nested test cases. This means all test cases for an
autotest must be in one suite, which is not ideal.
For example, in some cases we may want to run multiple lists of test
cases that each require different setup, so should be in separate suites.

The unit test suite struct is modified to hold a pointer to a list of
sub-testsuite pointers, along with the list of testcases as before.
Both should not be used at once, if there are sub-testsuite pointers,
that takes precedence over testcases.

Signed-off-by: Ciara Power <ciara.power@intel.com>

---
v2:
  - Added macro to loop sub-testsuites.
  - Added sub-testsuite summary detail.
---
 app/test/test.c | 168 ++++++++++++++++++++++++++++++++++--------------
 app/test/test.h |   1 +
 2 files changed, 122 insertions(+), 47 deletions(-)

diff --git a/app/test/test.c b/app/test/test.c
index a795cba1bb..e401de0fdf 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -41,6 +41,11 @@ extern cmdline_parse_ctx_t main_ctx[];
 		suite->unit_test_cases[iter].testcase;			\
 		iter++, case = suite->unit_test_cases[iter])
 
+#define FOR_EACH_SUITE_TESTSUITE(iter, suite, sub_ts)			\
+	for (iter = 0, sub_ts = suite->unit_test_suites[0];		\
+		suite->unit_test_suites[iter]->suite_name != NULL;	\
+		iter++, sub_ts = suite->unit_test_suites[iter])
+
 const char *prgname; /* to be set to argv[0] */
 
 static const char *recursive_call; /* used in linux for MP and other tests */
@@ -214,21 +219,46 @@ main(int argc, char **argv)
 
 static void
 unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite,
-		int test_success)
+		int test_success, unsigned int *sub_ts_failed,
+		unsigned int *sub_ts_skipped, unsigned int *sub_ts_total)
 {
 	struct unit_test_case tc;
-
-	FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
-		if (!tc.enabled || test_success == TEST_SKIPPED)
-			suite->skipped++;
-		else
-			suite->failed++;
+	struct unit_test_suite *ts;
+	int i;
+
+	if (suite->unit_test_suites) {
+		FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
+			unit_test_suite_count_tcs_on_setup_fail(
+				ts, test_success, sub_ts_failed,
+				sub_ts_skipped, sub_ts_total);
+			suite->total += ts->total;
+			suite->failed += ts->failed;
+			suite->skipped += ts->skipped;
+			if (ts->failed)
+				(*sub_ts_failed)++;
+			else
+				(*sub_ts_skipped)++;
+			(*sub_ts_total)++;
+		}
+	} else {
+		FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
+			if (!tc.enabled || test_success == TEST_SKIPPED)
+				suite->skipped++;
+			else
+				suite->failed++;
+		}
 	}
 }
 
 static void
 unit_test_suite_reset_counts(struct unit_test_suite *suite)
 {
+	struct unit_test_suite *ts;
+	int i;
+
+	if (suite->unit_test_suites)
+		FOR_EACH_SUITE_TESTSUITE(i, suite, ts)
+			unit_test_suite_reset_counts(ts);
 	suite->total = 0;
 	suite->executed = 0;
 	suite->succeeded = 0;
@@ -240,9 +270,12 @@ unit_test_suite_reset_counts(struct unit_test_suite *suite)
 int
 unit_test_suite_runner(struct unit_test_suite *suite)
 {
-	int test_success;
+	int test_success, i, ret;
 	const char *status;
 	struct unit_test_case tc;
+	struct unit_test_suite *ts;
+	unsigned int sub_ts_succeeded = 0, sub_ts_failed = 0;
+	unsigned int sub_ts_skipped = 0, sub_ts_total = 0;
 
 	unit_test_suite_reset_counts(suite);
 
@@ -259,70 +292,111 @@ unit_test_suite_runner(struct unit_test_suite *suite)
 			 * mark them as failed/skipped
 			 */
 			unit_test_suite_count_tcs_on_setup_fail(suite,
-					test_success);
+					test_success, &sub_ts_failed,
+					&sub_ts_skipped, &sub_ts_total);
 			goto suite_summary;
 		}
 	}
 
 	printf(" + ------------------------------------------------------- +\n");
 
-	FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
-		if (!tc.enabled) {
-			suite->skipped++;
-			continue;
-		} else {
-			suite->executed++;
+	if (suite->unit_test_suites) {
+		FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
+			ret = unit_test_suite_runner(ts);
+			if (ret == TEST_SUCCESS)
+				sub_ts_succeeded++;
+			else if (ret == TEST_SKIPPED)
+				sub_ts_skipped++;
+			else
+				sub_ts_failed++;
+			sub_ts_total++;
 		}
+	} else {
+		FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
+			if (!tc.enabled) {
+				suite->skipped++;
+				continue;
+			} else {
+				suite->executed++;
+			}
+
+			/* run test case setup */
+			if (tc.setup)
+				test_success = tc.setup();
+			else
+				test_success = TEST_SUCCESS;
+
+			if (test_success == TEST_SUCCESS) {
+				/* run the test case */
+				test_success = tc.testcase();
+				if (test_success == TEST_SUCCESS)
+					suite->succeeded++;
+				else if (test_success == TEST_SKIPPED)
+					suite->skipped++;
+				else if (test_success == -ENOTSUP)
+					suite->unsupported++;
+				else
+					suite->failed++;
+			} else if (test_success == -ENOTSUP) {
+				suite->unsupported++;
+			} else {
+				suite->failed++;
+			}
 
-		/* run test case setup */
-		if (tc.setup)
-			test_success = tc.setup();
-		else
-			test_success = TEST_SUCCESS;
+			/* run the test case teardown */
+			if (tc.teardown)
+				tc.teardown();
 
-		if (test_success == TEST_SUCCESS) {
-			/* run the test case */
-			test_success = tc.testcase();
 			if (test_success == TEST_SUCCESS)
-				suite->succeeded++;
+				status = "succeeded";
 			else if (test_success == TEST_SKIPPED)
-				suite->skipped++;
+				status = "skipped";
 			else if (test_success == -ENOTSUP)
-				suite->unsupported++;
+				status = "unsupported";
 			else
-				suite->failed++;
-		} else if (test_success == -ENOTSUP) {
-			suite->unsupported++;
-		} else {
-			suite->failed++;
-		}
+				status = "failed";
 
-		/* run the test case teardown */
-		if (tc.teardown)
-			tc.teardown();
-
-		if (test_success == TEST_SUCCESS)
-			status = "succeeded";
-		else if (test_success == TEST_SKIPPED)
-			status = "skipped";
-		else if (test_success == -ENOTSUP)
-			status = "unsupported";
-		else
-			status = "failed";
-
-		printf(" + TestCase [%2d] : %s %s\n", suite->total,
-				tc.name, status);
+			printf(" + TestCase [%2d] : %s %s\n", suite->total,
+					tc.name, status);
+		}
 	}
 
 	/* Run test suite teardown */
 	if (suite->teardown)
 		suite->teardown();
 
+	if (suite->unit_test_suites)
+		FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
+			suite->total += ts->total;
+			suite->succeeded += ts->succeeded;
+			suite->failed += ts->failed;
+			suite->skipped += ts->skipped;
+			suite->unsupported += ts->unsupported;
+			suite->executed += ts->executed;
+		}
+
 	goto suite_summary;
 
 suite_summary:
 	printf(" + ------------------------------------------------------- +\n");
 	printf(" + Test Suite Summary : %s\n", suite->suite_name);
+	printf(" + ------------------------------------------------------- +\n");
+
+	if (suite->unit_test_suites) {
+		FOR_EACH_SUITE_TESTSUITE(i, suite, ts)
+			printf(" + %s : %d/%d passed, %d/%d skipped, "
+				"%d/%d failed, %d/%d unsupported\n",
+				ts->suite_name, ts->succeeded, ts->total,
+				ts->skipped, ts->total, ts->failed, ts->total,
+				ts->unsupported, ts->total);
+		printf(" + ------------------------------------------------------- +\n");
+		printf(" + Sub Testsuites Total :     %2d\n", sub_ts_total);
+		printf(" + Sub Testsuites Skipped :   %2d\n", sub_ts_skipped);
+		printf(" + Sub Testsuites Passed :    %2d\n", sub_ts_succeeded);
+		printf(" + Sub Testsuites Failed :    %2d\n", sub_ts_failed);
+		printf(" + ------------------------------------------------------- +\n");
+	}
+
 	printf(" + Tests Total :       %2d\n", suite->total);
 	printf(" + Tests Skipped :     %2d\n", suite->skipped);
 	printf(" + Tests Executed :    %2d\n", suite->executed);
diff --git a/app/test/test.h b/app/test/test.h
index 10c7b496e6..e9bfc365e4 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -144,6 +144,7 @@ struct unit_test_suite {
 	unsigned int skipped;
 	unsigned int failed;
 	unsigned int unsupported;
+	struct unit_test_suite **unit_test_suites;
 	struct unit_test_case unit_test_cases[];
 };
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
  2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner Ciara Power
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format Ciara Power
@ 2021-04-02 14:24 ` Ciara Power
  2021-04-13 17:51   ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 4/6] test/crypto: move testsuite params to header file Ciara Power
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Ciara Power @ 2021-04-02 14:24 UTC (permalink / raw)
  To: dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Ciara Power

The existing implementation runs a giant cryptodev testsuite for most
autotests, which in turns runs one setup function regardless of device.

This is now broken down into multiple testsuites,
that are used as sub-testsuites. Each autotest has a parent test suite
for that device, to which the sub-testsuites are added.

For example, the AESNI_MB test has a parent "AESNI_MB Unit Test Suite",
with a setup function specifically for setting up an AESNI_MB device.
This autotest previously just ran the cryptodev_testsuite,
but now has the smaller sub-testsuites added to the parent suite instead.
The same test cases are being run as before.

The scheduler autotest no longer requires the extra test cases to
attach/set mode/detach when running the blockcipher test cases for
each mode. The attach/set mode/detach functionality is now tested in a
sub-testsuite. When running the sub-testsuites for each mode,
the attach/set mode/detach happens in the setup and teardown functions
for that sub-testsuite.

Signed-off-by: Ciara Power <ciara.power@intel.com>

---
v2:
  - Modified sub-testsuites to be added as pointers.
  - Made necessary changes resulting from v2 changes in previous patches.
---
 app/test/test_cryptodev.c | 1617 +++++++++++++++++++++++++++++--------
 1 file changed, 1261 insertions(+), 356 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index f91debc168..689121dcb4 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -112,6 +112,10 @@ struct crypto_unittest_params {
 #define ALIGN_POW2_ROUNDUP(num, align) \
 	(((num) + (align) - 1) & ~((align) - 1))
 
+#define ADD_STATIC_TESTSUITE(index, parent_ts, child_ts, num_child_ts)	\
+	for (j = 0; j < num_child_ts; index++, j++)			\
+		parent_ts.unit_test_suites[index] = child_ts[j]
+
 /*
  * Forward declarations.
  */
@@ -491,12 +495,11 @@ static struct crypto_testsuite_params testsuite_params = { NULL };
 static struct crypto_unittest_params unittest_params;
 
 static int
-testsuite_setup(void)
+testsuite_params_setup(void)
 {
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct rte_cryptodev_info info;
 	uint32_t i = 0, nb_devs, dev_id;
-	int ret;
 	uint16_t qp_id;
 
 	memset(ts_params, 0, sizeof(*ts_params));
@@ -542,217 +545,6 @@ testsuite_setup(void)
 		return TEST_FAILED;
 	}
 
-	/* Create an AESNI MB device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
-		if (nb_devs < 1) {
-			ret = rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
-
-			TEST_ASSERT(ret == 0,
-				"Failed to create instance of"
-				" pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
-		}
-	}
-
-	/* Create an AESNI GCM device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)));
-		if (nb_devs < 1) {
-			TEST_ASSERT_SUCCESS(rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL),
-				"Failed to create instance of"
-				" pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
-		}
-	}
-
-	/* Create a SNOW 3G device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)));
-		if (nb_devs < 1) {
-			TEST_ASSERT_SUCCESS(rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
-				"Failed to create instance of"
-				" pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
-		}
-	}
-
-	/* Create a KASUMI device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_KASUMI_PMD)));
-		if (nb_devs < 1) {
-			TEST_ASSERT_SUCCESS(rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
-				"Failed to create instance of"
-				" pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
-		}
-	}
-
-	/* Create a ZUC device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_ZUC_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_ZUC_PMD)));
-		if (nb_devs < 1) {
-			TEST_ASSERT_SUCCESS(rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
-				"Failed to create instance of"
-				" pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
-		}
-	}
-
-	/* Create a NULL device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_NULL_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_NULL_PMD)));
-		if (nb_devs < 1) {
-			ret = rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
-
-			TEST_ASSERT(ret == 0,
-				"Failed to create instance of"
-				" pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_NULL_PMD));
-		}
-	}
-
-	/* Create an OPENSSL device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)));
-		if (nb_devs < 1) {
-			ret = rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
-				NULL);
-
-			TEST_ASSERT(ret == 0, "Failed to create "
-				"instance of pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
-		}
-	}
-
-	/* Create a ARMv8 device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)));
-		if (nb_devs < 1) {
-			ret = rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
-				NULL);
-
-			TEST_ASSERT(ret == 0, "Failed to create "
-				"instance of pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
-		}
-	}
-
-	/* Create a MVSAM device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_MVSAM_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)));
-		if (nb_devs < 1) {
-			ret = rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_MVSAM_PMD),
-				NULL);
-
-			TEST_ASSERT(ret == 0, "Failed to create "
-				"instance of pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
-		}
-	}
-
-	/* Create an CCP device if required */
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_CCP_PMD))) {
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_CCP_PMD)));
-		if (nb_devs < 1) {
-			ret = rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_CCP_PMD),
-				NULL);
-
-			TEST_ASSERT(ret == 0, "Failed to create "
-				"instance of pmd : %s",
-				RTE_STR(CRYPTODEV_NAME_CCP_PMD));
-		}
-	}
-
-#ifdef RTE_CRYPTO_SCHEDULER
-	char vdev_args[VDEV_ARGS_SIZE] = {""};
-	char temp_str[VDEV_ARGS_SIZE] = {"mode=multi-core,"
-		"ordering=enable,name=cryptodev_test_scheduler,corelist="};
-	uint16_t worker_core_count = 0;
-	uint16_t socket_id = 0;
-
-	if (gbl_driver_id == rte_cryptodev_driver_id_get(
-			RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD))) {
-
-		/* Identify the Worker Cores
-		 * Use 2 worker cores for the device args
-		 */
-		RTE_LCORE_FOREACH_WORKER(i) {
-			if (worker_core_count > 1)
-				break;
-			snprintf(vdev_args, sizeof(vdev_args),
-					"%s%d", temp_str, i);
-			strcpy(temp_str, vdev_args);
-			strlcat(temp_str, ";", sizeof(temp_str));
-			worker_core_count++;
-			socket_id = rte_lcore_to_socket_id(i);
-		}
-		if (worker_core_count != 2) {
-			RTE_LOG(ERR, USER1,
-				"Cryptodev scheduler test require at least "
-				"two worker cores to run. "
-				"Please use the correct coremask.\n");
-			return TEST_FAILED;
-		}
-		strcpy(temp_str, vdev_args);
-		snprintf(vdev_args, sizeof(vdev_args), "%s,socket_id=%d",
-				temp_str, socket_id);
-		RTE_LOG(DEBUG, USER1, "vdev_args: %s\n", vdev_args);
-		nb_devs = rte_cryptodev_device_count_by_driver(
-				rte_cryptodev_driver_id_get(
-				RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)));
-		if (nb_devs < 1) {
-			ret = rte_vdev_init(
-				RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD),
-					vdev_args);
-			TEST_ASSERT(ret == 0,
-				"Failed to create instance %u of"
-				" pmd : %s",
-				i, RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
-		}
-	}
-#endif /* RTE_CRYPTO_SCHEDULER */
-
 	nb_devs = rte_cryptodev_count();
 	if (nb_devs < 1) {
 		RTE_LOG(WARNING, USER1, "No crypto devices found?\n");
@@ -838,6 +630,228 @@ testsuite_setup(void)
 	return TEST_SUCCESS;
 }
 
+static int
+qat_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+aesni_mb_testsuite_setup(void)
+{
+	int32_t nb_devs, ret;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
+	if (nb_devs < 1) {
+		ret = rte_vdev_init(RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
+
+		TEST_ASSERT(ret == 0,
+			"Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+virtio_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+openssl_testsuite_setup(void)
+{
+	int32_t nb_devs, ret;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)));
+	if (nb_devs < 1) {
+		ret = rte_vdev_init(RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD), NULL);
+
+		TEST_ASSERT(ret == 0, "Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+aesni_gcm_testsuite_setup(void)
+{
+	int32_t nb_devs;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)));
+	if (nb_devs < 1) {
+		TEST_ASSERT_SUCCESS(rte_vdev_init(
+			RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL),
+			"Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+null_testsuite_setup(void)
+{
+	int32_t nb_devs, ret;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_NULL_PMD)));
+	if (nb_devs < 1) {
+		ret = rte_vdev_init(RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
+
+		TEST_ASSERT(ret == 0,
+			"Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_NULL_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+sw_snow3g_testsuite_setup(void)
+{
+	int32_t nb_devs;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)));
+	if (nb_devs < 1) {
+		TEST_ASSERT_SUCCESS(rte_vdev_init(
+			RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
+			"Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+sw_kasumi_testsuite_setup(void)
+{
+	int32_t nb_devs;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD)));
+	if (nb_devs < 1) {
+		TEST_ASSERT_SUCCESS(rte_vdev_init(
+			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
+			"Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+sw_zuc_testsuite_setup(void)
+{
+	int32_t nb_devs;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_ZUC_PMD)));
+	if (nb_devs < 1) {
+		TEST_ASSERT_SUCCESS(rte_vdev_init(
+			RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
+			"Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+armv8_testsuite_setup(void)
+{
+	int32_t nb_devs, ret;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)));
+	if (nb_devs < 1) {
+		ret = rte_vdev_init(RTE_STR(CRYPTODEV_NAME_ARMV8_PMD), NULL);
+
+		TEST_ASSERT(ret == 0, "Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+mrvl_testsuite_setup(void)
+{
+	int32_t nb_devs, ret;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)));
+	if (nb_devs < 1) {
+		ret = rte_vdev_init(RTE_STR(CRYPTODEV_NAME_MVSAM_PMD), NULL);
+
+		TEST_ASSERT(ret == 0, "Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+dpaa_sec_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+dpaa2_sec_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+ccp_testsuite_setup(void)
+{
+	int32_t nb_devs, ret;
+	nb_devs = rte_cryptodev_device_count_by_driver(
+			rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_CCP_PMD)));
+	if (nb_devs < 1) {
+		ret = rte_vdev_init(RTE_STR(CRYPTODEV_NAME_CCP_PMD), NULL);
+
+		TEST_ASSERT(ret == 0, "Failed to create instance of pmd : %s",
+			RTE_STR(CRYPTODEV_NAME_CCP_PMD));
+	}
+	return testsuite_params_setup();
+}
+
+static int
+octeontx_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+octeontx2_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+caam_jr_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+nitrox_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+bcmfs_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
+static int
+qat_raw_testsuite_setup(void)
+{
+	return testsuite_params_setup();
+}
+
 static void
 testsuite_teardown(void)
 {
@@ -13069,6 +13083,59 @@ test_chacha20_poly1305_decrypt_test_case_rfc8439(void)
 /* global AESNI worker IDs for the scheduler test */
 uint8_t aesni_ids[2];
 
+static int
+scheduler_testsuite_setup(void)
+{
+	uint32_t i = 0;
+	int32_t nb_devs, ret;
+	char vdev_args[VDEV_ARGS_SIZE] = {""};
+	char temp_str[VDEV_ARGS_SIZE] = {"mode=multi-core,"
+		"ordering=enable,name=cryptodev_test_scheduler,corelist="};
+	uint16_t worker_core_count = 0;
+	uint16_t socket_id = 0;
+
+	if (gbl_driver_id == rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD))) {
+
+		/* Identify the Worker Cores
+		 * Use 2 worker cores for the device args
+		 */
+		RTE_LCORE_FOREACH_WORKER(i) {
+			if (worker_core_count > 1)
+				break;
+			snprintf(vdev_args, sizeof(vdev_args),
+					"%s%d", temp_str, i);
+			strcpy(temp_str, vdev_args);
+			strlcat(temp_str, ";", sizeof(temp_str));
+			worker_core_count++;
+			socket_id = rte_lcore_to_socket_id(i);
+		}
+		if (worker_core_count != 2) {
+			RTE_LOG(ERR, USER1,
+				"Cryptodev scheduler test require at least "
+				"two worker cores to run. "
+				"Please use the correct coremask.\n");
+			return TEST_FAILED;
+		}
+		strcpy(temp_str, vdev_args);
+		snprintf(vdev_args, sizeof(vdev_args), "%s,socket_id=%d",
+				temp_str, socket_id);
+		RTE_LOG(DEBUG, USER1, "vdev_args: %s\n", vdev_args);
+		nb_devs = rte_cryptodev_device_count_by_driver(
+				rte_cryptodev_driver_id_get(
+				RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)));
+		if (nb_devs < 1) {
+			ret = rte_vdev_init(
+				RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD),
+					vdev_args);
+			TEST_ASSERT(ret == 0,
+				"Failed to create instance %u of pmd : %s",
+				i, RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
+		}
+	}
+	return testsuite_params_setup();
+}
+
 static int
 test_scheduler_attach_slave_op(void)
 {
@@ -13243,53 +13310,63 @@ test_scheduler_mode_pkt_size_distr_op(void)
 	return 0;
 }
 
-static struct unit_test_suite cryptodev_scheduler_testsuite  = {
-	.suite_name = "Crypto Device Scheduler Unit Test Suite",
-	.setup = testsuite_setup,
-	.teardown = testsuite_teardown,
-	.unit_test_cases = {
-		/* Multi Core */
-		TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_mode_multicore_op),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
+static int
+scheduler_multicore_testsuite_setup(void)
+{
+	if (test_scheduler_attach_slave_op() < 0)
+		return -1;
+	if (test_scheduler_mode_op(CDEV_SCHED_MODE_MULTICORE) < 0)
+		return -1;
+	return 0;
+}
 
-		/* Round Robin */
-		TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_mode_roundrobin_op),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
+static int
+scheduler_roundrobin_testsuite_setup(void)
+{
+	if (test_scheduler_attach_slave_op() < 0)
+		return -1;
+	if (test_scheduler_mode_op(CDEV_SCHED_MODE_ROUNDROBIN) < 0)
+		return -1;
+	return 0;
+}
 
-		/* Fail over */
-		TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_mode_failover_op),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
+static int
+scheduler_failover_testsuite_setup(void)
+{
+	if (test_scheduler_attach_slave_op() < 0)
+		return -1;
+	if (test_scheduler_mode_op(CDEV_SCHED_MODE_FAILOVER) < 0)
+		return -1;
+	return 0;
+}
 
-		/* PKT SIZE */
-		TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_mode_pkt_size_distr_op),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-		TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
+static int
+scheduler_pkt_size_distr_testsuite_setup(void)
+{
+	if (test_scheduler_attach_slave_op() < 0)
+		return -1;
+	if (test_scheduler_mode_op(CDEV_SCHED_MODE_PKT_SIZE_DISTR) < 0)
+		return -1;
+	return 0;
+}
 
-		TEST_CASES_END() /**< NULL terminate unit test array */
-	}
-};
+static void
+scheduler_mode_testsuite_teardown(void)
+{
+	test_scheduler_detach_slave_op();
+}
 
 #endif /* RTE_CRYPTO_SCHEDULER */
 
+static struct unit_test_suite end_testsuite = {
+	.suite_name = NULL,
+	.setup = NULL,
+	.teardown = NULL,
+	.unit_test_suites = NULL
+};
+
 static struct unit_test_suite cryptodev_testsuite  = {
-	.suite_name = "Crypto Unit Test Suite",
-	.setup = testsuite_setup,
-	.teardown = testsuite_teardown,
+	.suite_name = "Crypto General Unit Test Suite",
 	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 				test_device_configure_invalid_dev_id),
@@ -13297,25 +13374,69 @@ static struct unit_test_suite cryptodev_testsuite  = {
 				test_queue_pair_descriptor_setup),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 				test_device_configure_invalid_queue_pair_ids),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_DES_cipheronly_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_docsis_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_DES_docsis_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_stats),
+#ifdef RTE_LIB_SECURITY
+		TEST_CASE_ST(ut_setup_security, ut_teardown,
+			test_PDCP_PROTO_all),
+		TEST_CASE_ST(ut_setup_security, ut_teardown,
+			test_DOCSIS_PROTO_all),
+#endif
+		TEST_CASE_ST(ut_setup, ut_teardown, test_enq_callback_setup),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_deq_callback_setup),
+		TEST_CASES_END() /**< NULL terminate unit test array */
+	}
+};
+
+static struct unit_test_suite cryptodev_negative_hmac_sha1_testsuite = {
+	.suite_name = "Negative HMAC SHA1 Unit Test Suite",
+	.unit_test_cases = {
+		/** Negative tests */
 		TEST_CASE_ST(ut_setup, ut_teardown,
-				test_multi_session),
+			authentication_verify_HMAC_SHA1_fail_data_corrupt),
+		TEST_CASE_ST(ut_setup, ut_teardown,
+			authentication_verify_HMAC_SHA1_fail_tag_corrupt),
+		TEST_CASE_ST(ut_setup, ut_teardown,
+			auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
+		TEST_CASE_ST(ut_setup, ut_teardown,
+			auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
+
+		TEST_CASES_END() /**< NULL terminate unit test array */
+	}
+};
+
+static struct unit_test_suite cryptodev_multi_session_testsuite = {
+	.suite_name = "Multi Session Unit Test Suite",
+	.unit_test_cases = {
+		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 				test_multi_session_random_usage),
 
+		TEST_CASES_END() /**< NULL terminate unit test array */
+	}
+};
+
+static struct unit_test_suite cryptodev_null_testsuite  = {
+	.suite_name = "NULL Test Suite",
+	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_null_invalid_operation),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_null_burst_operation),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_DES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_docsis_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_DES_docsis_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_stats),
+		TEST_CASES_END()
+	}
+};
 
-		/** AES CCM Authenticated Encryption 128 bits key */
+static struct unit_test_suite cryptodev_aes_ccm_auth_testsuite  = {
+	.suite_name = "AES CCM Authenticated Test Suite",
+	.unit_test_cases = {
+		/** AES CCM Authenticated Encryption 128 bits key*/
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_CCM_authenticated_encryption_test_case_128_1),
 		TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13362,7 +13483,13 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_AES_CCM_authenticated_decryption_test_case_256_2),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_CCM_authenticated_decryption_test_case_256_3),
+		TEST_CASES_END()
+	}
+};
 
+static struct unit_test_suite cryptodev_aes_gcm_auth_testsuite  = {
+	.suite_name = "AES GCM Authenticated Test Suite",
+	.unit_test_cases = {
 		/** AES GCM Authenticated Encryption */
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
@@ -13499,7 +13626,13 @@ static struct unit_test_suite cryptodev_testsuite  = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GCM_authenticated_decryption_sessionless_test_case_1),
 
-		/** AES GMAC Authentication */
+		TEST_CASES_END()
+	}
+};
+
+static struct unit_test_suite cryptodev_aes_gmac_auth_testsuite  = {
+	.suite_name = "AES GMAC Authentication Test Suite",
+	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GMAC_authentication_test_case_1),
 		TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13525,11 +13658,25 @@ static struct unit_test_suite cryptodev_testsuite  = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GMAC_authentication_SGL_2047B),
 
-		/** Chacha20-Poly1305 */
+		TEST_CASES_END()
+	}
+};
+
+static struct unit_test_suite cryptodev_chacha20_poly1305_testsuite  = {
+	.suite_name = "Chacha20-Poly1305 Test Suite",
+
+	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_chacha20_poly1305_encrypt_test_case_rfc8439),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_chacha20_poly1305_decrypt_test_case_rfc8439),
+		TEST_CASES_END()
+	}
+};
+
+static struct unit_test_suite cryptodev_snow3g_testsuite  = {
+	.suite_name = "SNOW 3G Test Suite",
+	.unit_test_cases = {
 		/** SNOW 3G encrypt only (UEA2) */
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_snow3g_encryption_test_case_1),
@@ -13610,6 +13757,7 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_snow3g_hash_generate_test_case_2),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_snow3g_hash_generate_test_case_3),
+
 		/* Tests with buffers which length is not byte-aligned */
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_snow3g_hash_generate_test_case_4),
@@ -13623,6 +13771,7 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_snow3g_hash_verify_test_case_2),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_snow3g_hash_verify_test_case_3),
+
 		/* Tests with buffers which length is not byte-aligned */
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_snow3g_hash_verify_test_case_4),
@@ -13634,7 +13783,13 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_snow3g_cipher_auth_test_case_1),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_snow3g_auth_cipher_with_digest_test_case_1),
+		TEST_CASES_END()
+	}
+};
 
+static struct unit_test_suite cryptodev_zuc_testsuite  = {
+	.suite_name = "ZUC Test Suite",
+	.unit_test_cases = {
 		/** ZUC encrypt only (EEA3) */
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_zuc_encryption_test_case_1),
@@ -13692,8 +13847,13 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_zuc_auth_cipher_verify_test_case_1_sgl),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_zuc_auth_cipher_verify_test_case_1_oop_sgl),
+		TEST_CASES_END()
+	}
+};
 
-		/** HMAC_MD5 Authentication */
+static struct unit_test_suite cryptodev_hmac_md5_auth_testsuite  = {
+	.suite_name = "HMAC_MD5 Authentication Test Suite",
+	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_MD5_HMAC_generate_case_1),
 		TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13702,7 +13862,13 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_MD5_HMAC_generate_case_2),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_MD5_HMAC_verify_case_2),
+		TEST_CASES_END()
+	}
+};
 
+static struct unit_test_suite cryptodev_kasumi_testsuite  = {
+	.suite_name = "Kasumi Test Suite",
+	.unit_test_cases = {
 		/** KASUMI hash only (UIA1) */
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_kasumi_hash_generate_test_case_1),
@@ -13787,17 +13953,24 @@ static struct unit_test_suite cryptodev_testsuite  = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_kasumi_auth_cipher_verify_test_case_2_oop_sgl),
 
-		/** ESN Testcase */
+		TEST_CASES_END()
+	}
+};
+
+static struct unit_test_suite cryptodev_esn_testsuite  = {
+	.suite_name = "ESN Test Suite",
+	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			auth_encrypt_AES128CBC_HMAC_SHA1_esn_check),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			auth_decrypt_AES128CBC_HMAC_SHA1_esn_check),
+		TEST_CASES_END()
+	}
+};
 
-		/** Negative tests */
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			authentication_verify_HMAC_SHA1_fail_data_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			authentication_verify_HMAC_SHA1_fail_tag_corrupt),
+static struct unit_test_suite cryptodev_negative_aes_gcm_testsuite  = {
+	.suite_name = "Negative AES GCM Test Suite",
+	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GCM_auth_encryption_fail_iv_corrupt),
 		TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13822,16 +13995,26 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_AES_GCM_auth_decryption_fail_aad_corrupt),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GCM_auth_decryption_fail_tag_corrupt),
+
+		TEST_CASES_END()
+	}
+};
+
+static struct unit_test_suite cryptodev_negative_aes_gmac_testsuite  = {
+	.suite_name = "Negative AES GMAC Test Suite",
+	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			authentication_verify_AES128_GMAC_fail_data_corrupt),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			authentication_verify_AES128_GMAC_fail_tag_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
 
-		/** Mixed CIPHER + HASH algorithms */
+		TEST_CASES_END()
+	}
+};
+
+static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite  = {
+	.suite_name = "Mixed CIPHER + HASH algorithms Test Suite",
+	.unit_test_cases = {
 		/** AUTH AES CMAC + CIPHER AES CTR */
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_aes_cmac_aes_ctr_digest_enc_test_case_1),
@@ -13844,11 +14027,11 @@ static struct unit_test_suite cryptodev_testsuite  = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1),
 		TEST_CASE_ST(ut_setup, ut_teardown,
-		       test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop),
+			test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop),
 		TEST_CASE_ST(ut_setup, ut_teardown,
-		       test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl),
+			test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl),
 		TEST_CASE_ST(ut_setup, ut_teardown,
-		   test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl),
+			test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl),
 
 		/** AUTH ZUC + CIPHER SNOW3G */
 		TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13911,23 +14094,12 @@ static struct unit_test_suite cryptodev_testsuite  = {
 			test_auth_aes_cmac_cipher_null_test_case_1),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_verify_auth_aes_cmac_cipher_null_test_case_1),
-
-#ifdef RTE_LIB_SECURITY
-		TEST_CASE_ST(ut_setup_security, ut_teardown,
-			test_PDCP_PROTO_all),
-		TEST_CASE_ST(ut_setup_security, ut_teardown,
-			test_DOCSIS_PROTO_all),
-#endif
-		TEST_CASE_ST(ut_setup, ut_teardown, test_enq_callback_setup),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_deq_callback_setup),
-		TEST_CASES_END() /**< NULL terminate unit test array */
+		TEST_CASES_END()
 	}
 };
 
-static struct unit_test_suite cryptodev_virtio_testsuite = {
+static struct unit_test_suite cryptodev_virtio_sub_testsuite = {
 	.suite_name = "Crypto VIRTIO Unit Test Suite",
-	.setup = testsuite_setup,
-	.teardown = testsuite_teardown,
 	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
 
@@ -13935,15 +14107,12 @@ static struct unit_test_suite cryptodev_virtio_testsuite = {
 	}
 };
 
-static struct unit_test_suite cryptodev_caam_jr_testsuite  = {
-	.suite_name = "Crypto CAAM JR Unit Test Suite",
-	.setup = testsuite_setup,
-	.teardown = testsuite_teardown,
+static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = {
+	.suite_name = "Crypto CAAM JR Sub Unit Test Suite",
 	.unit_test_cases = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
-			     test_device_configure_invalid_dev_id),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			     test_multi_session),
+				test_device_configure_invalid_dev_id),
+		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
 
 		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
@@ -13955,58 +14124,28 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite  = {
 	}
 };
 
-static struct unit_test_suite cryptodev_mrvl_testsuite  = {
+static struct unit_test_suite cryptodev_mrvl_sub_testsuite  = {
 	.suite_name = "Crypto Device Marvell Component Test Suite",
-	.setup = testsuite_setup,
-	.teardown = testsuite_teardown,
 	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-				test_multi_session_random_usage),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
 
-		/** Negative tests */
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			authentication_verify_HMAC_SHA1_fail_data_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			authentication_verify_HMAC_SHA1_fail_tag_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
-
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
 
-static struct unit_test_suite cryptodev_ccp_testsuite  = {
+static struct unit_test_suite cryptodev_ccp_sub_testsuite  = {
 	.suite_name = "Crypto Device CCP Unit Test Suite",
-	.setup = testsuite_setup,
-	.teardown = testsuite_teardown,
 	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-				test_multi_session_random_usage),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
 
-		/** Negative tests */
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			authentication_verify_HMAC_SHA1_fail_data_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			authentication_verify_HMAC_SHA1_fail_tag_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
-		TEST_CASE_ST(ut_setup, ut_teardown,
-			auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
-
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
@@ -14014,6 +14153,32 @@ static struct unit_test_suite cryptodev_ccp_testsuite  = {
 static int
 test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "QAT Unit Test Suite",
+		.setup = qat_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
 
@@ -14021,13 +14186,30 @@ test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
 		RTE_LOG(ERR, USER1, "QAT PMD must be loaded.\n");
 		return TEST_SKIPPED;
 	}
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_virtio_sub_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Virtio Unit Test Suite",
+		.setup = virtio_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
 
@@ -14035,13 +14217,45 @@ test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
 		RTE_LOG(ERR, USER1, "VIRTIO PMD must be loaded.\n");
 		return TEST_FAILED;
 	}
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
 
-	return unit_test_suite_runner(&cryptodev_virtio_testsuite);
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "AESNI_MB Unit Test Suite",
+		.setup = aesni_mb_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
 
@@ -14050,14 +14264,46 @@ test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_cpu_aesni_mb(void)
 {
 	int32_t rc;
+	uint8_t j, i = 0;
 	enum rte_security_session_action_type at;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "AESNI_MB CPU Unit Test Suite",
+		.setup = aesni_mb_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
 
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
@@ -14067,9 +14313,15 @@ test_cryptodev_cpu_aesni_mb(void)
 		return TEST_SKIPPED;
 	}
 
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+
 	at = gbl_action_type;
 	gbl_action_type = RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO;
-	rc = unit_test_suite_runner(&cryptodev_testsuite);
+	rc = unit_test_suite_runner(&ts);
+	free(ts.unit_test_suites);
 	gbl_action_type = at;
 	return rc;
 }
@@ -14077,6 +14329,32 @@ test_cryptodev_cpu_aesni_mb(void)
 static int
 test_cryptodev_openssl(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "OpenSSL Unit Test Suite",
+		.setup = openssl_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
 
@@ -14085,12 +14363,45 @@ test_cryptodev_openssl(void)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_aesni_gcm(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "AESNI_GCM Unit Test Suite",
+		.setup = aesni_gcm_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
 
@@ -14099,14 +14410,46 @@ test_cryptodev_aesni_gcm(void)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_cpu_aesni_gcm(void)
 {
 	int32_t rc;
+	uint8_t j, i = 0;
 	enum rte_security_session_action_type at;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "AESNI_GCM CPU Unit Test Suite",
+		.setup = aesni_gcm_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
 
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
@@ -14116,9 +14459,15 @@ test_cryptodev_cpu_aesni_gcm(void)
 		return TEST_SKIPPED;
 	}
 
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+
 	at = gbl_action_type;
 	gbl_action_type = RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO;
-	rc = unit_test_suite_runner(&cryptodev_testsuite);
+	rc  = unit_test_suite_runner(&ts);
+	free(ts.unit_test_suites);
 	gbl_action_type = at;
 	return rc;
 }
@@ -14126,6 +14475,32 @@ test_cryptodev_cpu_aesni_gcm(void)
 static int
 test_cryptodev_null(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Null Unit Test Suite",
+		.setup = null_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_NULL_PMD));
 
@@ -14134,12 +14509,45 @@ test_cryptodev_null(void)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "SW Snow3g Unit Test Suite",
+		.setup = sw_snow3g_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
 
@@ -14148,12 +14556,45 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "SW Kasumi Unit Test Suite",
+		.setup = sw_kasumi_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
 
@@ -14162,12 +14603,45 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "SW ZUC Unit Test Suite",
+		.setup = sw_zuc_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
 
@@ -14176,12 +14650,45 @@ test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_armv8(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Armv8 Unit Test Suite",
+		.setup = armv8_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
 
@@ -14190,12 +14697,46 @@ test_cryptodev_armv8(void)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_mrvl(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&cryptodev_mrvl_sub_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Crypto Device Marvell Component Test Suite",
+		.setup = mrvl_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
 
@@ -14204,7 +14745,14 @@ test_cryptodev_mrvl(void)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_mrvl_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 #ifdef RTE_CRYPTO_SCHEDULER
@@ -14212,6 +14760,84 @@ test_cryptodev_mrvl(void)
 static int
 test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	static struct unit_test_suite scheduler_multicore = {
+		.suite_name = "Scheduler Multicore Unit Test Suite",
+		.setup = scheduler_multicore_testsuite_setup,
+		.teardown = scheduler_mode_testsuite_teardown,
+		.unit_test_cases = {
+			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+			TEST_CASE_ST(ut_setup, ut_teardown,
+					test_AES_cipheronly_all),
+			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+			TEST_CASES_END()
+		}
+	};
+	static struct unit_test_suite scheduler_round_robin = {
+		.suite_name = "Scheduler Round Robin Unit Test Suite",
+		.setup = scheduler_roundrobin_testsuite_setup,
+		.teardown = scheduler_mode_testsuite_teardown,
+		.unit_test_cases = {
+			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+			TEST_CASE_ST(ut_setup, ut_teardown,
+					test_AES_cipheronly_all),
+			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+			TEST_CASES_END()
+		}
+	};
+	static struct unit_test_suite scheduler_failover = {
+		.suite_name = "Scheduler Failover Unit Test Suite",
+		.setup = scheduler_failover_testsuite_setup,
+		.teardown = scheduler_mode_testsuite_teardown,
+		.unit_test_cases = {
+			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+			TEST_CASE_ST(ut_setup, ut_teardown,
+					test_AES_cipheronly_all),
+			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+			TEST_CASES_END()
+		}
+	};
+	static struct unit_test_suite scheduler_pkt_size_distr = {
+		.suite_name = "Scheduler Pkt Size Distr Unit Test Suite",
+		.setup = scheduler_pkt_size_distr_testsuite_setup,
+		.teardown = scheduler_mode_testsuite_teardown,
+		.unit_test_cases = {
+			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+			TEST_CASE_ST(ut_setup, ut_teardown,
+					test_AES_cipheronly_all),
+			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+			TEST_CASES_END()
+		}
+	};
+	struct unit_test_suite *sched_mode_suites[] = {
+		&scheduler_multicore,
+		&scheduler_round_robin,
+		&scheduler_failover,
+		&scheduler_pkt_size_distr
+	};
+	static struct unit_test_suite scheduler_config = {
+		.suite_name = "Crypto Device Scheduler Config Unit Test Suite",
+		.unit_test_cases = {
+			TEST_CASE(test_scheduler_attach_slave_op),
+			TEST_CASE(test_scheduler_mode_multicore_op),
+			TEST_CASE(test_scheduler_mode_roundrobin_op),
+			TEST_CASE(test_scheduler_mode_failover_op),
+			TEST_CASE(test_scheduler_mode_pkt_size_distr_op),
+			TEST_CASE(test_scheduler_detach_slave_op),
+
+			TEST_CASES_END() /**< NULL terminate array */
+		}
+	};
+	struct unit_test_suite *static_suites[] = {
+		&scheduler_config,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Scheduler Unit Test Suite",
+		.setup = scheduler_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
 
@@ -14224,8 +14850,17 @@ test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/)
 				RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) == -1) {
 		RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded.\n");
 		return TEST_SKIPPED;
-}
-	return unit_test_suite_runner(&cryptodev_scheduler_testsuite);
+	}
+
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			(RTE_DIM(static_suites) + RTE_DIM(sched_mode_suites)));
+	ADD_STATIC_TESTSUITE(i, ts, sched_mode_suites,
+			RTE_DIM(sched_mode_suites));
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 REGISTER_TEST_COMMAND(cryptodev_scheduler_autotest, test_cryptodev_scheduler);
@@ -14235,6 +14870,32 @@ REGISTER_TEST_COMMAND(cryptodev_scheduler_autotest, test_cryptodev_scheduler);
 static int
 test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "DPAA2 Sec Test Suite",
+		.setup = dpaa2_sec_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
 
@@ -14243,12 +14904,45 @@ test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "DPAA Sec Test Suite",
+		.setup = dpaa_sec_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
 
@@ -14257,12 +14951,32 @@ test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_ccp(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_ccp_sub_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Crypto Device CCP Unit Test Suite",
+		.setup = ccp_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id = rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_CCP_PMD));
 
@@ -14271,36 +14985,124 @@ test_cryptodev_ccp(void)
 		return TEST_FAILED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_ccp_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_octeontx(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "OcteonTX Unit Test Suite",
+		.setup = octeontx_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
+
 	if (gbl_driver_id == -1) {
 		RTE_LOG(ERR, USER1, "OCTEONTX PMD must be loaded.\n");
 		return TEST_FAILED;
 	}
-	return unit_test_suite_runner(&cryptodev_testsuite);
+
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_octeontx2(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "OcteonTX2 Unit Test Suite",
+		.setup = octeontx2_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
+
 	if (gbl_driver_id == -1) {
 		RTE_LOG(ERR, USER1, "OCTEON TX2 PMD must be loaded.\n");
 		return TEST_FAILED;
 	}
-	return unit_test_suite_runner(&cryptodev_testsuite);
+
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_caam_jr(void /*argv __rte_unused, int argc __rte_unused*/)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_caam_jr_sub_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Crypto CAAM JR Unit Test Suite",
+		.setup = caam_jr_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD));
 
@@ -14309,12 +15111,45 @@ test_cryptodev_caam_jr(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_FAILED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_caam_jr_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_nitrox(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "Nitrox Unit Test Suite",
+		.setup = nitrox_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_NITROX_PMD));
 
@@ -14323,12 +15158,45 @@ test_cryptodev_nitrox(void)
 		return TEST_FAILED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_bcmfs(void)
 {
+	uint8_t ret, j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "BCMFS Unit Test Suite",
+		.setup = bcmfs_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
+
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_BCMFS_PMD));
 
@@ -14337,13 +15205,45 @@ test_cryptodev_bcmfs(void)
 		return TEST_FAILED;
 	}
 
-	return unit_test_suite_runner(&cryptodev_testsuite);
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
+	ret = unit_test_suite_runner(&ts);
+
+	free(ts.unit_test_suites);
+	return ret;
 }
 
 static int
 test_cryptodev_qat_raw_api(void /*argv __rte_unused, int argc __rte_unused*/)
 {
 	int ret;
+	uint8_t j, i = 0;
+	struct unit_test_suite *static_suites[] = {
+		&cryptodev_multi_session_testsuite,
+		&cryptodev_null_testsuite,
+		&cryptodev_aes_ccm_auth_testsuite,
+		&cryptodev_aes_gcm_auth_testsuite,
+		&cryptodev_aes_gmac_auth_testsuite,
+		&cryptodev_snow3g_testsuite,
+		&cryptodev_chacha20_poly1305_testsuite,
+		&cryptodev_zuc_testsuite,
+		&cryptodev_hmac_md5_auth_testsuite,
+		&cryptodev_kasumi_testsuite,
+		&cryptodev_esn_testsuite,
+		&cryptodev_negative_aes_gcm_testsuite,
+		&cryptodev_negative_aes_gmac_testsuite,
+		&cryptodev_mixed_cipher_hash_testsuite,
+		&cryptodev_negative_hmac_sha1_testsuite,
+		&cryptodev_testsuite,
+		&end_testsuite
+	};
+	struct unit_test_suite ts = {
+		.suite_name = "QAT Raw Unit Test Suite",
+		.setup = qat_raw_testsuite_setup,
+		.teardown = testsuite_teardown
+	};
 
 	gbl_driver_id =	rte_cryptodev_driver_id_get(
 			RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
@@ -14353,8 +15253,13 @@ test_cryptodev_qat_raw_api(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
+	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
+			RTE_DIM(static_suites));
+
+	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	global_api_test_type = CRYPTODEV_RAW_API_TEST;
-	ret = unit_test_suite_runner(&cryptodev_testsuite);
+	ret = unit_test_suite_runner(&ts);
+	free(ts.unit_test_suites);
 	global_api_test_type = CRYPTODEV_API_TEST;
 
 	return ret;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 4/6] test/crypto: move testsuite params to header file
  2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
                   ` (2 preceding siblings ...)
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites Ciara Power
@ 2021-04-02 14:24 ` Ciara Power
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 5/6] test/crypto: fix return value on test skipped Ciara Power
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Ciara Power @ 2021-04-02 14:24 UTC (permalink / raw)
  To: dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Ciara Power,
	Konstantin Ananyev, Bernard Iremonger, Vladimir Medvedkin

The testsuite params struct and ut functions are now in the cryptodev
test header file. This will allow them be used outside of the
cryptodev_test.c file. They will be used in a subsequent patch by the
blockcipher test.

As a result of this change, slight renaming changes were necessary
for ipsec and asym tests, to avoid a clash in names.

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 app/test/test_cryptodev.c      | 18 ++-----
 app/test/test_cryptodev.h      | 20 ++++++++
 app/test/test_cryptodev_asym.c | 93 ++++++++++++++++++----------------
 app/test/test_ipsec.c          | 32 ++++++------
 4 files changed, 89 insertions(+), 74 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 689121dcb4..ea751da432 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -72,19 +72,6 @@ static enum rte_security_session_action_type gbl_action_type =
 
 enum cryptodev_api_test_type global_api_test_type = CRYPTODEV_API_TEST;
 
-struct crypto_testsuite_params {
-	struct rte_mempool *mbuf_pool;
-	struct rte_mempool *large_mbuf_pool;
-	struct rte_mempool *op_mpool;
-	struct rte_mempool *session_mpool;
-	struct rte_mempool *session_priv_mpool;
-	struct rte_cryptodev_config conf;
-	struct rte_cryptodev_qp_conf qp_conf;
-
-	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
-	uint8_t valid_dev_count;
-};
-
 struct crypto_unittest_params {
 	struct rte_crypto_sym_xform cipher_xform;
 	struct rte_crypto_sym_xform auth_xform;
@@ -492,6 +479,7 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
 }
 
 static struct crypto_testsuite_params testsuite_params = { NULL };
+struct crypto_testsuite_params *p_testsuite_params = &testsuite_params;
 static struct crypto_unittest_params unittest_params;
 
 static int
@@ -922,7 +910,7 @@ dev_configure_and_start(uint64_t ff_disable)
 	return TEST_SUCCESS;
 }
 
-static int
+int
 ut_setup(void)
 {
 	/* Configure and start the device with security feature disabled */
@@ -936,7 +924,7 @@ ut_setup_security(void)
 	return dev_configure_and_start(0);
 }
 
-static void
+void
 ut_teardown(void)
 {
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h
index bf4f6c8d62..5b97f716a0 100644
--- a/app/test/test_cryptodev.h
+++ b/app/test/test_cryptodev.h
@@ -79,6 +79,20 @@ enum cryptodev_api_test_type {
 
 extern enum cryptodev_api_test_type global_api_test_type;
 
+extern struct crypto_testsuite_params *p_testsuite_params;
+struct crypto_testsuite_params {
+	struct rte_mempool *mbuf_pool;
+	struct rte_mempool *large_mbuf_pool;
+	struct rte_mempool *op_mpool;
+	struct rte_mempool *session_mpool;
+	struct rte_mempool *session_priv_mpool;
+	struct rte_cryptodev_config conf;
+	struct rte_cryptodev_qp_conf qp_conf;
+
+	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
+	uint8_t valid_dev_count;
+};
+
 /**
  * Write (spread) data from buffer to mbuf data
  *
@@ -222,4 +236,10 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 		struct rte_crypto_op *op, uint8_t is_cipher, uint8_t is_auth,
 		uint8_t len_in_bits, uint8_t cipher_iv_len);
 
+int
+ut_setup(void);
+
+void
+ut_teardown(void);
+
 #endif /* TEST_CRYPTODEV_H_ */
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 85cd076059..30d5447a06 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -35,7 +35,7 @@
 #define TEST_VECTOR_SIZE 256
 
 static int gbl_driver_id;
-struct crypto_testsuite_params {
+struct crypto_testsuite_params_asym {
 	struct rte_mempool *op_mpool;
 	struct rte_mempool *session_mpool;
 	struct rte_cryptodev_config conf;
@@ -63,12 +63,12 @@ static struct test_cases_array test_vector = {0, { NULL } };
 
 static uint32_t test_index;
 
-static struct crypto_testsuite_params testsuite_params = { NULL };
+static struct crypto_testsuite_params_asym testsuite_params = { NULL };
 
 static int
 queue_ops_rsa_sign_verify(struct rte_cryptodev_asym_session *sess)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_crypto_op *op, *result_op;
@@ -159,7 +159,7 @@ queue_ops_rsa_sign_verify(struct rte_cryptodev_asym_session *sess)
 static int
 queue_ops_rsa_enc_dec(struct rte_cryptodev_asym_session *sess)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_crypto_op *op, *result_op;
@@ -300,7 +300,7 @@ test_cryptodev_asym_ver(struct rte_crypto_op *op,
 }
 
 static int
-test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
+test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params,
 	union test_case_structure *data_tc,
 	char *test_msg, int sessionless, enum rte_crypto_asym_op_type type,
 	enum rte_crypto_rsa_priv_key_type key_type)
@@ -617,7 +617,7 @@ static int
 test_one_by_one(void)
 {
 	int status = TEST_SUCCESS;
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	uint32_t i = 0;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_info dev_info;
@@ -650,7 +650,7 @@ test_one_by_one(void)
 static int
 test_rsa_sign_verify(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_asym_session *sess;
@@ -699,7 +699,7 @@ test_rsa_sign_verify(void)
 static int
 test_rsa_enc_dec(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_asym_session *sess;
@@ -747,7 +747,7 @@ test_rsa_enc_dec(void)
 static int
 test_rsa_sign_verify_crt(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_asym_session *sess;
@@ -795,7 +795,7 @@ test_rsa_sign_verify_crt(void)
 static int
 test_rsa_enc_dec_crt(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_asym_session *sess;
@@ -842,7 +842,7 @@ test_rsa_enc_dec_crt(void)
 static int
 testsuite_setup(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
 	struct rte_cryptodev_info info;
 	int ret, dev_id = -1;
@@ -959,7 +959,7 @@ testsuite_setup(void)
 static void
 testsuite_teardown(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 
 	if (ts_params->op_mpool != NULL) {
 		RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
@@ -974,9 +974,9 @@ testsuite_teardown(void)
 }
 
 static int
-ut_setup(void)
+ut_setup_asym(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 
 	uint16_t qp_id;
 
@@ -1008,9 +1008,9 @@ ut_setup(void)
 }
 
 static void
-ut_teardown(void)
+ut_teardown_asym(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_cryptodev_stats stats;
 
 	rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
@@ -1056,7 +1056,7 @@ static inline void print_asym_capa(
 static int
 test_capability(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	uint8_t dev_id = ts_params->valid_devs[0];
 	struct rte_cryptodev_info dev_info;
 	const struct rte_cryptodev_capabilities *dev_capa;
@@ -1093,7 +1093,7 @@ test_capability(void)
 static int
 test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
@@ -1186,7 +1186,7 @@ test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
@@ -1277,7 +1277,7 @@ test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
@@ -1376,7 +1376,7 @@ test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
 static int
 test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
@@ -1473,7 +1473,7 @@ test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
 static int
 test_mod_inv(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
@@ -1597,7 +1597,7 @@ test_mod_inv(void)
 static int
 test_mod_exp(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
@@ -1757,7 +1757,7 @@ test_dh_keygenration(void)
 static int
 test_dsa_sign(void)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	uint8_t dev_id = ts_params->valid_devs[0];
@@ -1901,7 +1901,7 @@ test_dsa(void)
 static int
 test_ecdsa_sign_verify(enum curve curve_id)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct crypto_testsuite_ecdsa_params input_params;
@@ -2114,7 +2114,7 @@ test_ecdsa_sign_verify_all_curve(void)
 static int
 test_ecpm(enum curve curve_id)
 {
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
 	struct rte_mempool *sess_mpool = ts_params->session_mpool;
 	struct rte_mempool *op_mpool = ts_params->op_mpool;
 	struct crypto_testsuite_ecpm_params input_params;
@@ -2289,16 +2289,20 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite  = {
 	.setup = testsuite_setup,
 	.teardown = testsuite_teardown,
 	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_capability),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_dsa),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_dh_keygenration),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec_crt),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify_crt),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_mod_inv),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_dsa),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_dh_keygenration),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_rsa_enc_dec),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_rsa_sign_verify),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_rsa_enc_dec_crt),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_rsa_sign_verify_crt),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_inv),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
@@ -2308,7 +2312,7 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite  = {
 	.setup = testsuite_setup,
 	.teardown = testsuite_teardown,
 	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
@@ -2318,13 +2322,16 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite  = {
 	.setup = testsuite_setup,
 	.teardown = testsuite_teardown,
 	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_capability),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec_crt),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify_crt),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_rsa_enc_dec_crt),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_rsa_sign_verify_crt),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
 			     test_ecdsa_sign_verify_all_curve),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_ecpm_all_curve),
+		TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+				test_ecpm_all_curve),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index d18220a885..fb90130ae2 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -424,7 +424,7 @@ testsuite_teardown(void)
 }
 
 static int
-ut_setup(void)
+ut_setup_ipsec(void)
 {
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
@@ -444,7 +444,7 @@ ut_setup(void)
 }
 
 static void
-ut_teardown(void)
+ut_teardown_ipsec(void)
 {
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
@@ -2499,33 +2499,33 @@ static struct unit_test_suite ipsec_testsuite  = {
 	.setup = testsuite_setup,
 	.teardown = testsuite_teardown,
 	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_crypto_inb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_crypto_outb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_inline_crypto_inb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_inline_crypto_outb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_inline_proto_inb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_inline_proto_outb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_lksd_proto_inb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_lksd_proto_outb_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_replay_inb_inside_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_replay_inb_outside_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_replay_inb_repeat_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_replay_inb_inside_burst_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_crypto_inb_burst_2sa_null_null_wrapper),
-		TEST_CASE_ST(ut_setup, ut_teardown,
+		TEST_CASE_ST(ut_setup_ipsec, ut_teardown_ipsec,
 			test_ipsec_crypto_inb_burst_2sa_4grp_null_null_wrapper),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 5/6] test/crypto: fix return value on test skipped
  2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
                   ` (3 preceding siblings ...)
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 4/6] test/crypto: move testsuite params to header file Ciara Power
@ 2021-04-02 14:24 ` Ciara Power
  2021-04-13 17:07   ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 6/6] test/crypto: dynamically build blockcipher suite Ciara Power
  2021-04-06  1:34 ` [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ruifeng Wang
  6 siblings, 1 reply; 17+ messages in thread
From: Ciara Power @ 2021-04-02 14:24 UTC (permalink / raw)
  To: dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Ciara Power,
	roy.fan.zhang, stable

The blockcipher testcase return value TEST_SUCCESS was incorrect for
one conditional check, it should have been TEST_SKIPPED similar to the
other condition checks in this function when the testcase is skipped.

Fixes: 4868f6591c6f ("test/crypto: add cases for raw datapath API")
Cc: roy.fan.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 app/test/test_cryptodev_blockcipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index 135e57b9fa..8e168724be 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -160,7 +160,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 			printf("Raw Data Path APIs do not support OOP, "
 				"Test Skipped.\n");
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "SKIPPED");
-			status = TEST_SUCCESS;
+			status = TEST_SKIPPED;
 			goto error_exit;
 		}
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2 6/6] test/crypto: dynamically build blockcipher suite
  2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
                   ` (4 preceding siblings ...)
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 5/6] test/crypto: fix return value on test skipped Ciara Power
@ 2021-04-02 14:24 ` Ciara Power
  2021-04-06  1:34 ` [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ruifeng Wang
  6 siblings, 0 replies; 17+ messages in thread
From: Ciara Power @ 2021-04-02 14:24 UTC (permalink / raw)
  To: dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Ciara Power

In the existing implementation, the blockcipher test cases are being run
and reported as one test case per type, even though multiple test cases
are hidden in each. For example, "test_AES_chain_all" runs 46 test cases.
Each blockcipher type should have a testsuite instead.

The blockcipher testsuite is dynamically built, depending on the
blockcipher type chosen. The testcase struct is modified to allow
running a testcase with data, which is used for data required when
running each blockcipher testcase.

The blockcipher testsuites are added dynamically to parent testsuites
as sub-testsuites where needed.

Signed-off-by: Ciara Power <ciara.power@intel.com>

---
v2:
  - Squashed release note patch into this patch.
  - Modified the build blockcipher suite function to use the testcases
    flexible array, and return a testsuite pointer.
---
 app/test/test.c                        |  11 +-
 app/test/test.h                        |  16 +-
 app/test/test_cryptodev.c              | 507 +++++++++++++++----------
 app/test/test_cryptodev_blockcipher.c  | 125 +++---
 app/test/test_cryptodev_blockcipher.h  |  12 +-
 doc/guides/rel_notes/release_21_05.rst |   5 +
 6 files changed, 407 insertions(+), 269 deletions(-)

diff --git a/app/test/test.c b/app/test/test.c
index e401de0fdf..6151dbd55b 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -38,7 +38,8 @@ extern cmdline_parse_ctx_t main_ctx[];
 
 #define FOR_EACH_SUITE_TESTCASE(iter, suite, case)			\
 	for (iter = 0, case = suite->unit_test_cases[0];		\
-		suite->unit_test_cases[iter].testcase;			\
+		suite->unit_test_cases[iter].testcase ||		\
+		suite->unit_test_cases[iter].testcase_with_data;	\
 		iter++, case = suite->unit_test_cases[iter])
 
 #define FOR_EACH_SUITE_TESTSUITE(iter, suite, sub_ts)			\
@@ -328,7 +329,13 @@ unit_test_suite_runner(struct unit_test_suite *suite)
 
 			if (test_success == TEST_SUCCESS) {
 				/* run the test case */
-				test_success = tc.testcase();
+				if (tc.testcase)
+					test_success = tc.testcase();
+				else if (tc.testcase_with_data)
+					test_success = tc.testcase_with_data(tc.data);
+				else
+					test_success = -ENOTSUP;
+
 				if (test_success == TEST_SUCCESS)
 					suite->succeeded++;
 				else if (test_success == TEST_SKIPPED)
diff --git a/app/test/test.h b/app/test/test.h
index e9bfc365e4..3ec68cada0 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -108,24 +108,28 @@ struct unit_test_case {
 	int (*setup)(void);
 	void (*teardown)(void);
 	int (*testcase)(void);
+	int (*testcase_with_data)(const void *data);
 	const char *name;
 	unsigned enabled;
+	const void *data;
 };
 
-#define TEST_CASE(fn) { NULL, NULL, fn, #fn, 1 }
+#define TEST_CASE(fn) { NULL, NULL, fn, NULL, #fn, 1, NULL }
 
-#define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, name, 1 }
+#define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, NULL, name, 1, NULL }
 
 #define TEST_CASE_ST(setup, teardown, testcase) \
-		{ setup, teardown, testcase, #testcase, 1 }
+		{ setup, teardown, testcase, NULL, #testcase, 1, NULL }
 
+#define TEST_CASE_WITH_DATA(setup, teardown, testcase, data) \
+		{ setup, teardown, NULL, testcase, #testcase, 1, data }
 
-#define TEST_CASE_DISABLED(fn) { NULL, NULL, fn, #fn, 0 }
+#define TEST_CASE_DISABLED(fn) { NULL, NULL, fn, NULL, #fn, 0, NULL }
 
 #define TEST_CASE_ST_DISABLED(setup, teardown, testcase) \
-		{ setup, teardown, testcase, #testcase, 0 }
+		{ setup, teardown, testcase, NULL, #testcase, 0, NULL }
 
-#define TEST_CASES_END() { NULL, NULL, NULL, NULL, 0 }
+#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL, 0, NULL }
 
 static inline void
 debug_hexdump(FILE *file, const char *title, const void *buf, size_t len)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index ea751da432..86569d7a3d 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -103,6 +103,15 @@ struct crypto_unittest_params {
 	for (j = 0; j < num_child_ts; index++, j++)			\
 		parent_ts.unit_test_suites[index] = child_ts[j]
 
+#define ADD_BLOCKCIPHER_TESTSUITE(index, parent_ts, blk_types, num_blk_types)	\
+	for (j = 0; j < num_blk_types; index++, j++)				\
+		parent_ts.unit_test_suites[index] =				\
+				build_blockcipher_test_suite(blk_types[j])
+
+#define FREE_BLOCKCIPHER_TESTSUITE(index, parent_ts, num_blk_types)		\
+	for (j = index; j < index + num_blk_types; j++)				\
+		free_blockcipher_test_suite(parent_ts.unit_test_suites[j])
+
 /*
  * Forward declarations.
  */
@@ -1921,80 +1930,6 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess,
 	return TEST_SUCCESS;
 }
 
-static int
-test_blockcipher(enum blockcipher_test_type test_type)
-{
-	struct crypto_testsuite_params *ts_params = &testsuite_params;
-	int status;
-
-	status = test_blockcipher_all_tests(ts_params->mbuf_pool,
-		ts_params->op_mpool,
-		ts_params->session_mpool, ts_params->session_priv_mpool,
-		ts_params->valid_devs[0],
-		test_type);
-
-	if (status == -ENOTSUP)
-		return status;
-
-	TEST_ASSERT_EQUAL(status, 0, "Test failed");
-
-	return TEST_SUCCESS;
-}
-
-static int
-test_AES_cipheronly_all(void)
-{
-	return test_blockcipher(BLKCIPHER_AES_CIPHERONLY_TYPE);
-}
-
-static int
-test_AES_docsis_all(void)
-{
-	/* Data-path service does not support DOCSIS yet */
-	if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
-		return -ENOTSUP;
-	return test_blockcipher(BLKCIPHER_AES_DOCSIS_TYPE);
-}
-
-static int
-test_DES_docsis_all(void)
-{
-	/* Data-path service does not support DOCSIS yet */
-	if (global_api_test_type == CRYPTODEV_RAW_API_TEST)
-		return -ENOTSUP;
-	return test_blockcipher(BLKCIPHER_DES_DOCSIS_TYPE);
-}
-
-static int
-test_DES_cipheronly_all(void)
-{
-	return test_blockcipher(BLKCIPHER_DES_CIPHERONLY_TYPE);
-}
-
-static int
-test_authonly_all(void)
-{
-	return test_blockcipher(BLKCIPHER_AUTHONLY_TYPE);
-}
-
-static int
-test_AES_chain_all(void)
-{
-	return test_blockcipher(BLKCIPHER_AES_CHAIN_TYPE);
-}
-
-static int
-test_3DES_chain_all(void)
-{
-	return test_blockcipher(BLKCIPHER_3DES_CHAIN_TYPE);
-}
-
-static int
-test_3DES_cipheronly_all(void)
-{
-	return test_blockcipher(BLKCIPHER_3DES_CIPHERONLY_TYPE);
-}
-
 /* ***** SNOW 3G Tests ***** */
 static int
 create_wireless_algo_hash_session(uint8_t dev_id,
@@ -13362,14 +13297,6 @@ static struct unit_test_suite cryptodev_testsuite  = {
 				test_queue_pair_descriptor_setup),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 				test_device_configure_invalid_queue_pair_ids),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_DES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_docsis_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_DES_docsis_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_stats),
 #ifdef RTE_LIB_SECURITY
 		TEST_CASE_ST(ut_setup_security, ut_teardown,
@@ -14086,15 +14013,6 @@ static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite  = {
 	}
 };
 
-static struct unit_test_suite cryptodev_virtio_sub_testsuite = {
-	.suite_name = "Crypto VIRTIO Unit Test Suite",
-	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-
-		TEST_CASES_END() /**< NULL terminate unit test array */
-	}
-};
-
 static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = {
 	.suite_name = "Crypto CAAM JR Sub Unit Test Suite",
 	.unit_test_cases = {
@@ -14102,38 +14020,6 @@ static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = {
 				test_device_configure_invalid_dev_id),
 		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
 
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-
-		TEST_CASES_END() /**< NULL terminate unit test array */
-	}
-};
-
-static struct unit_test_suite cryptodev_mrvl_sub_testsuite  = {
-	.suite_name = "Crypto Device Marvell Component Test Suite",
-	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
-
-		TEST_CASES_END() /**< NULL terminate unit test array */
-	}
-};
-
-static struct unit_test_suite cryptodev_ccp_sub_testsuite  = {
-	.suite_name = "Crypto Device CCP Unit Test Suite",
-	.unit_test_cases = {
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
-		TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
@@ -14141,7 +14027,16 @@ static struct unit_test_suite cryptodev_ccp_sub_testsuite  = {
 static int
 test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14175,11 +14070,13 @@ test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14187,9 +14084,11 @@ test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CIPHERONLY_TYPE
+	};
 	struct unit_test_suite *static_suites[] = {
-		&cryptodev_virtio_sub_testsuite,
 		&end_testsuite
 	};
 	struct unit_test_suite ts = {
@@ -14206,11 +14105,13 @@ test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_FAILED;
 	}
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14218,7 +14119,16 @@ test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14253,11 +14163,13 @@ test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14266,8 +14178,17 @@ static int
 test_cryptodev_cpu_aesni_mb(void)
 {
 	int32_t rc;
-	uint8_t j, i = 0;
+	uint8_t j, i = 0, blk_start_idx = 0;
 	enum rte_security_session_action_type at;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14302,13 +14223,15 @@ test_cryptodev_cpu_aesni_mb(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 
 	at = gbl_action_type;
 	gbl_action_type = RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO;
 	rc = unit_test_suite_runner(&ts);
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	gbl_action_type = at;
 	return rc;
@@ -14317,7 +14240,16 @@ test_cryptodev_cpu_aesni_mb(void)
 static int
 test_cryptodev_openssl(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14352,11 +14284,13 @@ test_cryptodev_openssl(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14364,7 +14298,16 @@ test_cryptodev_openssl(void)
 static int
 test_cryptodev_aesni_gcm(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14399,11 +14342,13 @@ test_cryptodev_aesni_gcm(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14412,8 +14357,17 @@ static int
 test_cryptodev_cpu_aesni_gcm(void)
 {
 	int32_t rc;
-	uint8_t j, i = 0;
+	uint8_t j, i = 0, blk_start_idx = 0;
 	enum rte_security_session_action_type at;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14448,13 +14402,15 @@ test_cryptodev_cpu_aesni_gcm(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 
 	at = gbl_action_type;
 	gbl_action_type = RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO;
 	rc  = unit_test_suite_runner(&ts);
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	gbl_action_type = at;
 	return rc;
@@ -14463,7 +14419,16 @@ test_cryptodev_cpu_aesni_gcm(void)
 static int
 test_cryptodev_null(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14498,11 +14463,13 @@ test_cryptodev_null(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14510,7 +14477,16 @@ test_cryptodev_null(void)
 static int
 test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14545,11 +14521,13 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14557,7 +14535,16 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14592,11 +14579,13 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14604,7 +14593,16 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14639,11 +14637,13 @@ test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14651,7 +14651,16 @@ test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_armv8(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14686,11 +14695,13 @@ test_cryptodev_armv8(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14698,7 +14709,13 @@ test_cryptodev_armv8(void)
 static int
 test_cryptodev_mrvl(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14716,7 +14733,6 @@ test_cryptodev_mrvl(void)
 		&cryptodev_mixed_cipher_hash_testsuite,
 		&cryptodev_negative_hmac_sha1_testsuite,
 		&cryptodev_testsuite,
-		&cryptodev_mrvl_sub_testsuite,
 		&end_testsuite
 	};
 	struct unit_test_suite ts = {
@@ -14734,11 +14750,13 @@ test_cryptodev_mrvl(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14748,54 +14766,31 @@ test_cryptodev_mrvl(void)
 static int
 test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, sched_i, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE
+	};
 	static struct unit_test_suite scheduler_multicore = {
 		.suite_name = "Scheduler Multicore Unit Test Suite",
 		.setup = scheduler_multicore_testsuite_setup,
-		.teardown = scheduler_mode_testsuite_teardown,
-		.unit_test_cases = {
-			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-			TEST_CASE_ST(ut_setup, ut_teardown,
-					test_AES_cipheronly_all),
-			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-			TEST_CASES_END()
-		}
+		.teardown = scheduler_mode_testsuite_teardown
 	};
 	static struct unit_test_suite scheduler_round_robin = {
 		.suite_name = "Scheduler Round Robin Unit Test Suite",
 		.setup = scheduler_roundrobin_testsuite_setup,
-		.teardown = scheduler_mode_testsuite_teardown,
-		.unit_test_cases = {
-			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-			TEST_CASE_ST(ut_setup, ut_teardown,
-					test_AES_cipheronly_all),
-			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-			TEST_CASES_END()
-		}
+		.teardown = scheduler_mode_testsuite_teardown
 	};
 	static struct unit_test_suite scheduler_failover = {
 		.suite_name = "Scheduler Failover Unit Test Suite",
 		.setup = scheduler_failover_testsuite_setup,
-		.teardown = scheduler_mode_testsuite_teardown,
-		.unit_test_cases = {
-			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-			TEST_CASE_ST(ut_setup, ut_teardown,
-					test_AES_cipheronly_all),
-			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-			TEST_CASES_END()
-		}
+		.teardown = scheduler_mode_testsuite_teardown
 	};
 	static struct unit_test_suite scheduler_pkt_size_distr = {
 		.suite_name = "Scheduler Pkt Size Distr Unit Test Suite",
 		.setup = scheduler_pkt_size_distr_testsuite_setup,
-		.teardown = scheduler_mode_testsuite_teardown,
-		.unit_test_cases = {
-			TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-			TEST_CASE_ST(ut_setup, ut_teardown,
-					test_AES_cipheronly_all),
-			TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-			TEST_CASES_END()
-		}
+		.teardown = scheduler_mode_testsuite_teardown
 	};
 	struct unit_test_suite *sched_mode_suites[] = {
 		&scheduler_multicore,
@@ -14840,6 +14835,16 @@ test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/)
 		return TEST_SKIPPED;
 	}
 
+	for (sched_i = 0; sched_i < RTE_DIM(sched_mode_suites); sched_i++) {
+		uint8_t blk_i = 0;
+		sched_mode_suites[sched_i]->unit_test_suites = malloc(sizeof
+				(struct unit_test_suite *) *
+				(RTE_DIM(blk_suites) + 1));
+		ADD_BLOCKCIPHER_TESTSUITE(blk_i, (*sched_mode_suites[sched_i]),
+				blk_suites, RTE_DIM(blk_suites));
+		sched_mode_suites[sched_i]->unit_test_suites[blk_i] = &end_testsuite;
+	}
+
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
 			(RTE_DIM(static_suites) + RTE_DIM(sched_mode_suites)));
 	ADD_STATIC_TESTSUITE(i, ts, sched_mode_suites,
@@ -14847,6 +14852,12 @@ test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/)
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	for (sched_i = 0; sched_i < RTE_DIM(sched_mode_suites); sched_i++) {
+		FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx,
+				(*sched_mode_suites[sched_i]),
+				RTE_DIM(blk_suites));
+		free(sched_mode_suites[sched_i]->unit_test_suites);
+	}
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14858,7 +14869,16 @@ REGISTER_TEST_COMMAND(cryptodev_scheduler_autotest, test_cryptodev_scheduler);
 static int
 test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14893,11 +14913,13 @@ test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14905,7 +14927,16 @@ test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -14940,11 +14971,13 @@ test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14952,11 +14985,16 @@ test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_ccp(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_negative_hmac_sha1_testsuite,
-		&cryptodev_ccp_sub_testsuite,
 		&end_testsuite
 	};
 	struct unit_test_suite ts = {
@@ -14974,11 +15012,13 @@ test_cryptodev_ccp(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -14986,7 +15026,16 @@ test_cryptodev_ccp(void)
 static int
 test_cryptodev_octeontx(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -15021,11 +15070,13 @@ test_cryptodev_octeontx(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -15033,7 +15084,16 @@ test_cryptodev_octeontx(void)
 static int
 test_cryptodev_octeontx2(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -15068,11 +15128,13 @@ test_cryptodev_octeontx2(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -15080,7 +15142,13 @@ test_cryptodev_octeontx2(void)
 static int
 test_cryptodev_caam_jr(void /*argv __rte_unused, int argc __rte_unused*/)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_caam_jr_sub_testsuite,
 		&end_testsuite
@@ -15100,11 +15168,13 @@ test_cryptodev_caam_jr(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -15112,7 +15182,16 @@ test_cryptodev_caam_jr(void /*argv __rte_unused, int argc __rte_unused*/)
 static int
 test_cryptodev_nitrox(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -15147,11 +15226,13 @@ test_cryptodev_nitrox(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -15159,7 +15240,16 @@ test_cryptodev_nitrox(void)
 static int
 test_cryptodev_bcmfs(void)
 {
-	uint8_t ret, j, i = 0;
+	uint8_t ret, j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_AES_DOCSIS_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_DOCSIS_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -15194,11 +15284,13 @@ test_cryptodev_bcmfs(void)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	ret = unit_test_suite_runner(&ts);
 
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	return ret;
 }
@@ -15207,7 +15299,14 @@ static int
 test_cryptodev_qat_raw_api(void /*argv __rte_unused, int argc __rte_unused*/)
 {
 	int ret;
-	uint8_t j, i = 0;
+	uint8_t j, i = 0, blk_start_idx = 0;
+	const enum blockcipher_test_type blk_suites[] = {
+		BLKCIPHER_AES_CHAIN_TYPE,
+		BLKCIPHER_AES_CIPHERONLY_TYPE,
+		BLKCIPHER_3DES_CHAIN_TYPE,
+		BLKCIPHER_3DES_CIPHERONLY_TYPE,
+		BLKCIPHER_DES_CIPHERONLY_TYPE,
+		BLKCIPHER_AUTHONLY_TYPE};
 	struct unit_test_suite *static_suites[] = {
 		&cryptodev_multi_session_testsuite,
 		&cryptodev_null_testsuite,
@@ -15242,11 +15341,13 @@ test_cryptodev_qat_raw_api(void /*argv __rte_unused, int argc __rte_unused*/)
 	}
 
 	ts.unit_test_suites = malloc(sizeof(struct unit_test_suite *) *
-			RTE_DIM(static_suites));
+			(RTE_DIM(blk_suites) + RTE_DIM(static_suites)));
 
+	ADD_BLOCKCIPHER_TESTSUITE(i, ts, blk_suites, RTE_DIM(blk_suites));
 	ADD_STATIC_TESTSUITE(i, ts, static_suites, RTE_DIM(static_suites));
 	global_api_test_type = CRYPTODEV_RAW_API_TEST;
 	ret = unit_test_suite_runner(&ts);
+	FREE_BLOCKCIPHER_TESTSUITE(blk_start_idx, ts, RTE_DIM(blk_suites));
 	free(ts.unit_test_suites);
 	global_api_test_type = CRYPTODEV_API_TEST;
 
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index 8e168724be..9c844c6bd2 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -738,82 +738,105 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 	return status;
 }
 
-int
-test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
-	struct rte_mempool *op_mpool,
-	struct rte_mempool *sess_mpool,
-	struct rte_mempool *sess_priv_mpool,
-	uint8_t dev_id,
-	enum blockcipher_test_type test_type)
+static int
+blockcipher_test_case_run(const void *data)
 {
-	int status, overall_status = TEST_SUCCESS;
-	uint32_t i, test_index = 0;
+	const struct blockcipher_test_case *tc_data = data;
+	int status;
 	char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
-	uint32_t n_test_cases = 0;
-	const struct blockcipher_test_case *tcs = NULL;
+
+	status = test_blockcipher_one_case(tc_data,
+			p_testsuite_params->mbuf_pool,
+			p_testsuite_params->op_mpool,
+			p_testsuite_params->session_mpool,
+			p_testsuite_params->session_priv_mpool,
+			p_testsuite_params->valid_devs[0],
+			test_msg);
+	return status;
+}
+
+struct unit_test_suite *
+build_blockcipher_test_suite(enum blockcipher_test_type test_type)
+{
+	int i, n_test_cases = 0;
+	struct unit_test_suite *ts;
+	const char *ts_name = NULL;
+	const struct blockcipher_test_case *blk_tcs;
+	struct unit_test_case *tc;
 
 	switch (test_type) {
 	case BLKCIPHER_AES_CHAIN_TYPE:
-		n_test_cases = sizeof(aes_chain_test_cases) /
-		sizeof(aes_chain_test_cases[0]);
-		tcs = aes_chain_test_cases;
+		n_test_cases = RTE_DIM(aes_chain_test_cases);
+		blk_tcs = aes_chain_test_cases;
+		ts_name = "AES Chain";
 		break;
 	case BLKCIPHER_AES_CIPHERONLY_TYPE:
-		n_test_cases = sizeof(aes_cipheronly_test_cases) /
-		sizeof(aes_cipheronly_test_cases[0]);
-		tcs = aes_cipheronly_test_cases;
+		n_test_cases = RTE_DIM(aes_cipheronly_test_cases);
+		blk_tcs = aes_cipheronly_test_cases;
+		ts_name = "AES Cipher Only";
 		break;
 	case BLKCIPHER_AES_DOCSIS_TYPE:
-		n_test_cases = sizeof(aes_docsis_test_cases) /
-		sizeof(aes_docsis_test_cases[0]);
-		tcs = aes_docsis_test_cases;
+		n_test_cases = RTE_DIM(aes_docsis_test_cases);
+		blk_tcs = aes_docsis_test_cases;
+		ts_name = "AES Docsis";
 		break;
 	case BLKCIPHER_3DES_CHAIN_TYPE:
-		n_test_cases = sizeof(triple_des_chain_test_cases) /
-		sizeof(triple_des_chain_test_cases[0]);
-		tcs = triple_des_chain_test_cases;
+		n_test_cases = RTE_DIM(triple_des_chain_test_cases);
+		blk_tcs = triple_des_chain_test_cases;
+		ts_name = "3DES Chain";
 		break;
 	case BLKCIPHER_3DES_CIPHERONLY_TYPE:
-		n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
-		sizeof(triple_des_cipheronly_test_cases[0]);
-		tcs = triple_des_cipheronly_test_cases;
+		n_test_cases = RTE_DIM(triple_des_cipheronly_test_cases);
+		blk_tcs = triple_des_cipheronly_test_cases;
+		ts_name = "3DES Cipher Only";
 		break;
 	case BLKCIPHER_DES_CIPHERONLY_TYPE:
-		n_test_cases = sizeof(des_cipheronly_test_cases) /
-		sizeof(des_cipheronly_test_cases[0]);
-		tcs = des_cipheronly_test_cases;
+		n_test_cases = RTE_DIM(des_cipheronly_test_cases);
+		blk_tcs = des_cipheronly_test_cases;
+		ts_name = "DES Cipher Only";
 		break;
 	case BLKCIPHER_DES_DOCSIS_TYPE:
-		n_test_cases = sizeof(des_docsis_test_cases) /
-		sizeof(des_docsis_test_cases[0]);
-		tcs = des_docsis_test_cases;
+		n_test_cases = RTE_DIM(des_docsis_test_cases);
+		blk_tcs = des_docsis_test_cases;
+		ts_name = "DES Docsis";
 		break;
 	case BLKCIPHER_AUTHONLY_TYPE:
-		n_test_cases = sizeof(hash_test_cases) /
-		sizeof(hash_test_cases[0]);
-		tcs = hash_test_cases;
+		n_test_cases = RTE_DIM(hash_test_cases);
+		blk_tcs = hash_test_cases;
+		ts_name = "Auth Only";
 		break;
 	default:
 		break;
 	}
 
-	for (i = 0; i < n_test_cases; i++) {
-		const struct blockcipher_test_case *tc = &tcs[i];
-
-		status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
-			sess_mpool, sess_priv_mpool, dev_id,
-			test_msg);
-
-		printf("  %u) TestCase %s %s\n", test_index ++,
-			tc->test_descr, test_msg);
+	ts = calloc(1, sizeof(struct unit_test_suite) +
+			(sizeof(struct unit_test_case) * (n_test_cases + 1)));
+	ts->suite_name = ts_name;
 
-		if (status == TEST_FAILED) {
-			overall_status = status;
-
-			if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
-				break;
-		}
+	for (i = 0; i < n_test_cases; i++) {
+		tc = &ts->unit_test_cases[i];
+		tc->name = blk_tcs[i].test_descr;
+		tc->enabled = 1;
+		tc->setup = ut_setup;
+		tc->teardown = ut_teardown;
+		tc->testcase = NULL;
+		tc->testcase_with_data = blockcipher_test_case_run;
+		tc->data = &blk_tcs[i];
 	}
+	tc = &ts->unit_test_cases[i];
+	tc->name = NULL;
+	tc->enabled = 0;
+	tc->setup = NULL;
+	tc->teardown = NULL;
+	tc->testcase = NULL;
+	tc->testcase_with_data = NULL;
+	tc->data = NULL;
+
+	return ts;
+}
 
-	return overall_status;
+void
+free_blockcipher_test_suite(struct unit_test_suite *ts)
+{
+	free(ts);
 }
diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h
index 8990716844..ad2a4fd61b 100644
--- a/app/test/test_cryptodev_blockcipher.h
+++ b/app/test/test_cryptodev_blockcipher.h
@@ -89,12 +89,10 @@ struct blockcipher_test_data {
 	unsigned int auth_offset;
 };
 
-int
-test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
-	struct rte_mempool *op_mpool,
-	struct rte_mempool *sess_mpool,
-	struct rte_mempool *sess_priv_mpool,
-	uint8_t dev_id,
-	enum blockcipher_test_type test_type);
+struct unit_test_suite *
+build_blockcipher_test_suite(enum blockcipher_test_type test_type);
+
+void
+free_blockcipher_test_suite(struct unit_test_suite *ts);
 
 #endif /* TEST_CRYPTODEV_BLOCKCIPHER_H_ */
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 19cec62c73..cf1fbb5533 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -126,6 +126,11 @@ New Features
   * Added command to display Rx queue used descriptor count.
     ``show port (port_id) rxq (queue_id) desc used count``
 
+* **Added sub-testsuite support.**
+
+  * The unit test suite struct now supports having either a nested
+    list of sub-testsuites, or a list of testcases as before.
+
 
 Removed Items
 -------------
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner Ciara Power
@ 2021-04-05 12:10   ` Aaron Conole
  0 siblings, 0 replies; 17+ messages in thread
From: Aaron Conole @ 2021-04-05 12:10 UTC (permalink / raw)
  To: Ciara Power
  Cc: dev, declan.doherty, gakhil, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh

Ciara Power <ciara.power@intel.com> writes:

> Some small changes were made to the unit test suite runner for
> readability and to enable reuse of some of the function in a later patch.
>
> On test suite setup skip/fail, the loop to count testcases as
> skipped/failed has been moved to another function.
> This will allow for recursion in a later patch when nested sub-testsuites
> are used.
>
> The unit test suite runner accessed the list of testcases in the suite
> structure every time the testcase was used. This is now replaced by a
> testcase variable which improves readability.
>
> A macro has been introduced for readability, instead of using open
> coded loops.
>
> Rather than keep local variable status counts for testcases,
> these are added to the test suite structure.
>
> The summary output now prints the suite name, this will be useful later
> when multiple nested sub-testsuites are being run.
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
>
> ---
> v2:
>   - Added macro to loop testcases in suite.
>   - Testcase counts added to the test suite structure.
> ---

Acked-by: Aaron Conole <aconole@redhat.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format Ciara Power
@ 2021-04-05 12:30   ` Aaron Conole
  0 siblings, 0 replies; 17+ messages in thread
From: Aaron Conole @ 2021-04-05 12:30 UTC (permalink / raw)
  To: Ciara Power
  Cc: dev, declan.doherty, gakhil, hemant.agrawal, anoobj,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Bruce Richardson

Ciara Power <ciara.power@intel.com> writes:

> The current structure for unit testing only allows for running a
> test suite with nested test cases. This means all test cases for an
> autotest must be in one suite, which is not ideal.
> For example, in some cases we may want to run multiple lists of test
> cases that each require different setup, so should be in separate suites.
>
> The unit test suite struct is modified to hold a pointer to a list of
> sub-testsuite pointers, along with the list of testcases as before.
> Both should not be used at once, if there are sub-testsuite pointers,
> that takes precedence over testcases.
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
>
> ---
> v2:
>   - Added macro to loop sub-testsuites.
>   - Added sub-testsuite summary detail.
> ---
>  app/test/test.c | 168 ++++++++++++++++++++++++++++++++++--------------
>  app/test/test.h |   1 +
>  2 files changed, 122 insertions(+), 47 deletions(-)
>
> diff --git a/app/test/test.c b/app/test/test.c
> index a795cba1bb..e401de0fdf 100644
> --- a/app/test/test.c
> +++ b/app/test/test.c
> @@ -41,6 +41,11 @@ extern cmdline_parse_ctx_t main_ctx[];
>  		suite->unit_test_cases[iter].testcase;			\
>  		iter++, case = suite->unit_test_cases[iter])
>  
> +#define FOR_EACH_SUITE_TESTSUITE(iter, suite, sub_ts)			\
> +	for (iter = 0, sub_ts = suite->unit_test_suites[0];		\
> +		suite->unit_test_suites[iter]->suite_name != NULL;	\
> +		iter++, sub_ts = suite->unit_test_suites[iter])
> +
>  const char *prgname; /* to be set to argv[0] */
>  
>  static const char *recursive_call; /* used in linux for MP and other tests */
> @@ -214,21 +219,46 @@ main(int argc, char **argv)
>  
>  static void
>  unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite,
> -		int test_success)
> +		int test_success, unsigned int *sub_ts_failed,
> +		unsigned int *sub_ts_skipped, unsigned int *sub_ts_total)
>  {
>  	struct unit_test_case tc;
> -
> -	FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
> -		if (!tc.enabled || test_success == TEST_SKIPPED)
> -			suite->skipped++;
> -		else
> -			suite->failed++;
> +	struct unit_test_suite *ts;
> +	int i;
> +
> +	if (suite->unit_test_suites) {
> +		FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
> +			unit_test_suite_count_tcs_on_setup_fail(
> +				ts, test_success, sub_ts_failed,
> +				sub_ts_skipped, sub_ts_total);
> +			suite->total += ts->total;
> +			suite->failed += ts->failed;
> +			suite->skipped += ts->skipped;
> +			if (ts->failed)
> +				(*sub_ts_failed)++;
> +			else
> +				(*sub_ts_skipped)++;
> +			(*sub_ts_total)++;
> +		}
> +	} else {
> +		FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
> +			if (!tc.enabled || test_success == TEST_SKIPPED)
> +				suite->skipped++;
> +			else
> +				suite->failed++;
> +		}
>  	}
>  }
>  
>  static void
>  unit_test_suite_reset_counts(struct unit_test_suite *suite)
>  {
> +	struct unit_test_suite *ts;
> +	int i;
> +
> +	if (suite->unit_test_suites)
> +		FOR_EACH_SUITE_TESTSUITE(i, suite, ts)
> +			unit_test_suite_reset_counts(ts);
>  	suite->total = 0;
>  	suite->executed = 0;
>  	suite->succeeded = 0;
> @@ -240,9 +270,12 @@ unit_test_suite_reset_counts(struct unit_test_suite *suite)
>  int
>  unit_test_suite_runner(struct unit_test_suite *suite)
>  {
> -	int test_success;
> +	int test_success, i, ret;
>  	const char *status;
>  	struct unit_test_case tc;
> +	struct unit_test_suite *ts;
> +	unsigned int sub_ts_succeeded = 0, sub_ts_failed = 0;
> +	unsigned int sub_ts_skipped = 0, sub_ts_total = 0;
>  
>  	unit_test_suite_reset_counts(suite);
>  
> @@ -259,70 +292,111 @@ unit_test_suite_runner(struct unit_test_suite *suite)
>  			 * mark them as failed/skipped
>  			 */
>  			unit_test_suite_count_tcs_on_setup_fail(suite,
> -					test_success);
> +					test_success, &sub_ts_failed,
> +					&sub_ts_skipped, &sub_ts_total);
>  			goto suite_summary;
>  		}
>  	}
>  
>  	printf(" + ------------------------------------------------------- +\n");
>  
> -	FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
> -		if (!tc.enabled) {
> -			suite->skipped++;
> -			continue;
> -		} else {
> -			suite->executed++;
> +	if (suite->unit_test_suites) {
> +		FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
> +			ret = unit_test_suite_runner(ts);
> +			if (ret == TEST_SUCCESS)
> +				sub_ts_succeeded++;
> +			else if (ret == TEST_SKIPPED)
> +				sub_ts_skipped++;
> +			else
> +				sub_ts_failed++;
> +			sub_ts_total++;
>  		}
> +	} else {
> +		FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
> +			if (!tc.enabled) {
> +				suite->skipped++;
> +				continue;
> +			} else {
> +				suite->executed++;
> +			}
> +
> +			/* run test case setup */
> +			if (tc.setup)
> +				test_success = tc.setup();
> +			else
> +				test_success = TEST_SUCCESS;
> +
> +			if (test_success == TEST_SUCCESS) {
> +				/* run the test case */
> +				test_success = tc.testcase();
> +				if (test_success == TEST_SUCCESS)
> +					suite->succeeded++;
> +				else if (test_success == TEST_SKIPPED)
> +					suite->skipped++;
> +				else if (test_success == -ENOTSUP)
> +					suite->unsupported++;
> +				else
> +					suite->failed++;
> +			} else if (test_success == -ENOTSUP) {
> +				suite->unsupported++;
> +			} else {
> +				suite->failed++;
> +			}
>  
> -		/* run test case setup */
> -		if (tc.setup)
> -			test_success = tc.setup();
> -		else
> -			test_success = TEST_SUCCESS;
> +			/* run the test case teardown */
> +			if (tc.teardown)
> +				tc.teardown();
>  
> -		if (test_success == TEST_SUCCESS) {
> -			/* run the test case */
> -			test_success = tc.testcase();
>  			if (test_success == TEST_SUCCESS)
> -				suite->succeeded++;
> +				status = "succeeded";
>  			else if (test_success == TEST_SKIPPED)
> -				suite->skipped++;
> +				status = "skipped";
>  			else if (test_success == -ENOTSUP)
> -				suite->unsupported++;
> +				status = "unsupported";
>  			else
> -				suite->failed++;
> -		} else if (test_success == -ENOTSUP) {
> -			suite->unsupported++;
> -		} else {
> -			suite->failed++;
> -		}
> +				status = "failed";
>  
> -		/* run the test case teardown */
> -		if (tc.teardown)
> -			tc.teardown();
> -
> -		if (test_success == TEST_SUCCESS)
> -			status = "succeeded";
> -		else if (test_success == TEST_SKIPPED)
> -			status = "skipped";
> -		else if (test_success == -ENOTSUP)
> -			status = "unsupported";
> -		else
> -			status = "failed";
> -
> -		printf(" + TestCase [%2d] : %s %s\n", suite->total,
> -				tc.name, status);
> +			printf(" + TestCase [%2d] : %s %s\n", suite->total,
> +					tc.name, status);
> +		}
>  	}
>  
>  	/* Run test suite teardown */
>  	if (suite->teardown)
>  		suite->teardown();
>  
> +	if (suite->unit_test_suites)
> +		FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
> +			suite->total += ts->total;
> +			suite->succeeded += ts->succeeded;
> +			suite->failed += ts->failed;
> +			suite->skipped += ts->skipped;
> +			suite->unsupported += ts->unsupported;
> +			suite->executed += ts->executed;
> +		}
> +
>  	goto suite_summary;
>  
>  suite_summary:
>  	printf(" + ------------------------------------------------------- +\n");
>  	printf(" + Test Suite Summary : %s\n", suite->suite_name);
> +	printf(" + ------------------------------------------------------- +\n");
> +
> +	if (suite->unit_test_suites) {
> +		FOR_EACH_SUITE_TESTSUITE(i, suite, ts)
> +			printf(" + %s : %d/%d passed, %d/%d skipped, "
> +				"%d/%d failed, %d/%d unsupported\n",
> +				ts->suite_name, ts->succeeded, ts->total,
> +				ts->skipped, ts->total, ts->failed, ts->total,
> +				ts->unsupported, ts->total);
> +		printf(" + ------------------------------------------------------- +\n");
> +		printf(" + Sub Testsuites Total :     %2d\n", sub_ts_total);
> +		printf(" + Sub Testsuites Skipped :   %2d\n", sub_ts_skipped);
> +		printf(" + Sub Testsuites Passed :    %2d\n", sub_ts_succeeded);
> +		printf(" + Sub Testsuites Failed :    %2d\n", sub_ts_failed);
> +		printf(" + ------------------------------------------------------- +\n");
> +	}
> +
>  	printf(" + Tests Total :       %2d\n", suite->total);
>  	printf(" + Tests Skipped :     %2d\n", suite->skipped);
>  	printf(" + Tests Executed :    %2d\n", suite->executed);
> diff --git a/app/test/test.h b/app/test/test.h
> index 10c7b496e6..e9bfc365e4 100644
> --- a/app/test/test.h
> +++ b/app/test/test.h
> @@ -144,6 +144,7 @@ struct unit_test_suite {
>  	unsigned int skipped;
>  	unsigned int failed;
>  	unsigned int unsupported;
> +	struct unit_test_suite **unit_test_suites;

If it's only ever possible to either have test_suites or test_cases for
iterators, maybe it's best to put in an assert for that.

Either way, we probably don't need to

  if (suite->unit_test_suites) {
     ...
  } else {
     ...
  }

It might be better to just look like:

  FOR_EACH_SUITE_TESTSUITE(...) {
     ...
  }

  FOR_EACH_SUITE_TESTCASE(...) {
     ...
  }

Code looks nicer, and we can also support a mix of suite/case (unless
there is a reason not to do that). WDYT?  As the code exists, if I were
to write a new test suite with some sub-test suites, I might do:


  overall_suite {
     .unit_test_suite = {
        {sub_suite1, ...},
        {sub_suite2, ...}
     },
     .unit_test_cases = {
        {test_case_1, ...},
        {test_case_2, ...}
     }
  }

And then I would be surprised if they didn't run.

>  	struct unit_test_case unit_test_cases[];
>  };


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework
  2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
                   ` (5 preceding siblings ...)
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 6/6] test/crypto: dynamically build blockcipher suite Ciara Power
@ 2021-04-06  1:34 ` Ruifeng Wang
  6 siblings, 0 replies; 17+ messages in thread
From: Ruifeng Wang @ 2021-04-06  1:34 UTC (permalink / raw)
  To: Ciara Power, dev
  Cc: declan.doherty, gakhil, aconole, hemant.agrawal, anoobj,
	asomalap, Ajit Khaparde (ajit.khaparde@broadcom.com),
	g.singh, nd

> -----Original Message-----
> From: Ciara Power <ciara.power@intel.com>
> Sent: Friday, April 2, 2021 10:24 PM
> To: dev@dpdk.org
> Cc: declan.doherty@intel.com; gakhil@marvell.com; aconole@redhat.com;
> hemant.agrawal@nxp.com; anoobj@marvell.com; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; asomalap@amd.com; Ajit Khaparde
> (ajit.khaparde@broadcom.com) <ajit.khaparde@broadcom.com>;
> g.singh@nxp.com; Ciara Power <ciara.power@intel.com>
> Subject: [PATCH v2 0/6] test: refactor crypto unit test framework
> 
> v2:
>   - Added macro in place of testcase/testsuite loops.
>   - Added more detail in the summary output.
>   - Moved testcase counts to the testsuite structure.
>   - Flattened testsuite structure to remove union.
>   - Added patch for fix of blockcipher test return value.
>   - Squashed release note into last patch.
> 
> The current crypto unit test framework is not granular enough to accurately
> track unit test results. This is caused by one testcase in a suite actually
> running multiple testcases, but only returning one result.
> 
> The approach taken in this patchset allows a test suite have either a list of
> sub-testsuites, or a list of testcases as previously used.
> The unit test suite runner can then recursively iterate and run the sub-
> testsuites, until it reaches a suite with testcases, and it then runs each
> testcase as it had done previously.
> 
> By allowing this further breakdown into sub-testsuites, a refactor of the
> crypto unit tests solves the issue of inaccurate reporting, as sub-testsuites
> can be used in place of the testcases that had multiple testcases hidden on a
> sub level.
> The blockcipher tests previously had these hidden testcases, but are now
> sub-testsuites that are dynamically created and added to a parent test suite,
> allowing for each testcase status to be reported directly to the runner.
> The cryptodev test suite is broken down into smaller suites that are used as
> sub-testsuites, which allows for more flexibility choosing which sub-
> testsuites should run for the current device autotest.
> The introduction of sub-testsuites also allows for more precise
> setup/teardown functions, rather than general ones loaded with conditions
> as was seen with the initial setup function used for all crypto testsuites.
> 
> For example, when running the cryptodev_aesni_mb_autotest, the AESNI
> MB parent test suite has its own setup function to initialise the AESNI MB
> device.
> Various sub-testsuites are added to the parent test suite, such as some of
> the static suites that were once in the cryptodev_testsuite, and blockcipher
> suites.
> The unit test runner can then run the AESNI MB parent test suite, which in
> turn will run the sub-testsuites.
> 
> Documentation will be added in a later version of the patchset, adding to the
> test document that isn't yet merged. [1]
> 
> ---
> [1]
> https://patchwork.dpdk.org/project/dpdk/patch/20210309155757.615536-1-
> aconole@redhat.com/
> 
> Ciara Power (6):
>   app/test: refactor of unit test suite runner
>   test: introduce parent testsuite format
>   test/crypto: refactor to use sub-testsuites
>   test/crypto: move testsuite params to header file
>   test/crypto: fix return value on test skipped
>   test/crypto: dynamically build blockcipher suite
> 
>  app/test/test.c                        |  226 ++-
>  app/test/test.h                        |   23 +-
>  app/test/test_cryptodev.c              | 1964 ++++++++++++++++++------
>  app/test/test_cryptodev.h              |   20 +
>  app/test/test_cryptodev_asym.c         |   93 +-
>  app/test/test_cryptodev_blockcipher.c  |  127 +-
>  app/test/test_cryptodev_blockcipher.h  |   12 +-
>  app/test/test_ipsec.c                  |   32 +-
>  doc/guides/rel_notes/release_21_05.rst |    5 +
>  9 files changed, 1831 insertions(+), 671 deletions(-)
> 
> --
> 2.25.1

Tested against armv8crypto PMD and the result looks good.
Tested-by: Ruifeng Wang <ruifeng.wang@arm.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2 5/6] test/crypto: fix return value on test skipped
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 5/6] test/crypto: fix return value on test skipped Ciara Power
@ 2021-04-13 17:07   ` Akhil Goyal
  0 siblings, 0 replies; 17+ messages in thread
From: Akhil Goyal @ 2021-04-13 17:07 UTC (permalink / raw)
  To: Ciara Power, dev
  Cc: declan.doherty, aconole, hemant.agrawal, Anoob Joseph,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, roy.fan.zhang,
	stable

> The blockcipher testcase return value TEST_SUCCESS was incorrect for
> one conditional check, it should have been TEST_SKIPPED similar to the
> other condition checks in this function when the testcase is skipped.
> 
> Fixes: 4868f6591c6f ("test/crypto: add cases for raw datapath API")
> Cc: roy.fan.zhang@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
Acked-by: Akhil Goyal <gakhil@marvell.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
  2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites Ciara Power
@ 2021-04-13 17:51   ` Akhil Goyal
  2021-04-13 18:17     ` Thomas Monjalon
  2021-04-14 11:12     ` Doherty, Declan
  0 siblings, 2 replies; 17+ messages in thread
From: Akhil Goyal @ 2021-04-13 17:51 UTC (permalink / raw)
  To: Ciara Power, dev
  Cc: declan.doherty, aconole, hemant.agrawal, Anoob Joseph,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Matan Azrad,
	NBU-Contact-Thomas Monjalon

Hi Ciara,

//snip

>  	nb_devs = rte_cryptodev_count();
>  	if (nb_devs < 1) {
>  		RTE_LOG(WARNING, USER1, "No crypto devices found?\n");
> @@ -838,6 +630,228 @@ testsuite_setup(void)
>  	return TEST_SUCCESS;
>  }
> 
> +static int
> +qat_testsuite_setup(void)
> +{
> +	return testsuite_params_setup();
> +}
> +
> +static int
> +aesni_mb_testsuite_setup(void)
> +{
> +	int32_t nb_devs, ret;
> +	nb_devs = rte_cryptodev_device_count_by_driver(
> +			rte_cryptodev_driver_id_get(
> +			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
> +	if (nb_devs < 1) {
> +		ret =
> rte_vdev_init(RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
> +
> +		TEST_ASSERT(ret == 0,
> +			"Failed to create instance of pmd : %s",
> +			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
> +	}
> +	return testsuite_params_setup();
> +}

Why is it required to have a separate function for each of the PMD?
I believe a single function with an argument should be sufficient.
And in that single function a simple switch case may process the vdevs differently.

As of now, it looks that moving the unnecessary duplicate code from
one place to another.

This was one cleanup we have been looking forward to from quite some time.
Every time a new PMD comes, a separate function is formed and the length of
the code increases.


//snip
> 
> -static struct unit_test_suite cryptodev_virtio_testsuite = {
> +static struct unit_test_suite cryptodev_virtio_sub_testsuite = {
>  	.suite_name = "Crypto VIRTIO Unit Test Suite",
> -	.setup = testsuite_setup,
> -	.teardown = testsuite_teardown,
>  	.unit_test_cases = {
>  		TEST_CASE_ST(ut_setup, ut_teardown,
> test_AES_cipheronly_all),
> 
> @@ -13935,15 +14107,12 @@ static struct unit_test_suite
> cryptodev_virtio_testsuite = {
>  	}
>  };
> 
> -static struct unit_test_suite cryptodev_caam_jr_testsuite  = {
> -	.suite_name = "Crypto CAAM JR Unit Test Suite",
> -	.setup = testsuite_setup,
> -	.teardown = testsuite_teardown,
> +static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = {
> +	.suite_name = "Crypto CAAM JR Sub Unit Test Suite",
>  	.unit_test_cases = {
>  		TEST_CASE_ST(ut_setup, ut_teardown,
> -			     test_device_configure_invalid_dev_id),
> -		TEST_CASE_ST(ut_setup, ut_teardown,
> -			     test_multi_session),
> +				test_device_configure_invalid_dev_id),
> +		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
> 
>  		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
>  		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
> @@ -13955,58 +14124,28 @@ static struct unit_test_suite
> cryptodev_caam_jr_testsuite  = {
>  	}
>  };

Splitting the complete testsuite into logical generic algo based sub testsuite
Is a good idea. I appreciate that.

But introducing PMD based test suite is not recommended. We have been
trying from past few releases to clean this up. And this patch is again introducing
the same. When I first saw this series, I saw only the algo based splitting and
when it was run on the board, it was showing results in an organized way.
But this was not expected that, PMD based test suites are reintroduced by
Intel who helped in removing them in last few releases.

This will make an unnecessary addition of duplicate code whenever a new PMD
is introduced.

I recommend to use a single parent suite - cryptodev_testsuite and there
Can be multiple sub testsuites based on Algos etc. but not on the basis of PMD.

Regards,
Akhil


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
  2021-04-13 17:51   ` [dpdk-dev] [EXT] " Akhil Goyal
@ 2021-04-13 18:17     ` Thomas Monjalon
  2021-04-14 11:12     ` Doherty, Declan
  1 sibling, 0 replies; 17+ messages in thread
From: Thomas Monjalon @ 2021-04-13 18:17 UTC (permalink / raw)
  To: Ciara Power, Akhil Goyal
  Cc: dev, declan.doherty, aconole, hemant.agrawal, Anoob Joseph,
	ruifeng.wang, asomalap, ajit.khaparde, g.singh, Matan Azrad

13/04/2021 19:51, Akhil Goyal:
> Splitting the complete testsuite into logical generic algo based sub testsuite
> Is a good idea. I appreciate that.
> 
> But introducing PMD based test suite is not recommended. We have been
> trying from past few releases to clean this up. And this patch is again introducing
> the same. When I first saw this series, I saw only the algo based splitting and
> when it was run on the board, it was showing results in an organized way.
> But this was not expected that, PMD based test suites are reintroduced by
> Intel who helped in removing them in last few releases.
> 
> This will make an unnecessary addition of duplicate code whenever a new PMD
> is introduced.
> 
> I recommend to use a single parent suite - cryptodev_testsuite and there
> Can be multiple sub testsuites based on Algos etc. but not on the basis of PMD.

+1

If a PMD has specifics, it should be expressed through the API,
with capabilities or any other generic way.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
  2021-04-13 17:51   ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-04-13 18:17     ` Thomas Monjalon
@ 2021-04-14 11:12     ` Doherty, Declan
  2021-04-14 11:18       ` Akhil Goyal
  1 sibling, 1 reply; 17+ messages in thread
From: Doherty, Declan @ 2021-04-14 11:12 UTC (permalink / raw)
  To: Akhil Goyal, Ciara Power, dev
  Cc: aconole, hemant.agrawal, Anoob Joseph, ruifeng.wang, asomalap,
	ajit.khaparde, g.singh, Matan Azrad, NBU-Contact-Thomas Monjalon



On 13/04/2021 6:51 PM, Akhil Goyal wrote:
> Hi Ciara,
> 
> //snip
> 
>>   	nb_devs = rte_cryptodev_count();
>>   	if (nb_devs < 1) {
>>   		RTE_LOG(WARNING, USER1, "No crypto devices found?\n");
>> @@ -838,6 +630,228 @@ testsuite_setup(void)
>>   	return TEST_SUCCESS;
>>   }
>>
>> +static int
>> +qat_testsuite_setup(void)
>> +{
>> +	return testsuite_params_setup();
>> +}
>> +
>> +static int
>> +aesni_mb_testsuite_setup(void)
>> +{
>> +	int32_t nb_devs, ret;
>> +	nb_devs = rte_cryptodev_device_count_by_driver(
>> +			rte_cryptodev_driver_id_get(
>> +			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
>> +	if (nb_devs < 1) {
>> +		ret =
>> rte_vdev_init(RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
>> +
>> +		TEST_ASSERT(ret == 0,
>> +			"Failed to create instance of pmd : %s",
>> +			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
>> +	}
>> +	return testsuite_params_setup();
>> +}
> 
> Why is it required to have a separate function for each of the PMD?
> I believe a single function with an argument should be sufficient.
> And in that single function a simple switch case may process the vdevs differently.
> 
> As of now, it looks that moving the unnecessary duplicate code from
> one place to another.
> 
> This was one cleanup we have been looking forward to from quite some time.
> Every time a new PMD comes, a separate function is formed and the length of
> the code increases.
> 
> 
> //snip

The virtual device creation code could be dropped completely if user is 
guaranteed to create the required crypto PMD from EAL devargs and we 
could assume that the first crypto device of the test suite type is 
always used?

>>
>> -static struct unit_test_suite cryptodev_virtio_testsuite = {
>> +static struct unit_test_suite cryptodev_virtio_sub_testsuite = {
>>   	.suite_name = "Crypto VIRTIO Unit Test Suite",
>> -	.setup = testsuite_setup,
>> -	.teardown = testsuite_teardown,
>>   	.unit_test_cases = {
>>   		TEST_CASE_ST(ut_setup, ut_teardown,
>> test_AES_cipheronly_all),
>>
>> @@ -13935,15 +14107,12 @@ static struct unit_test_suite
>> cryptodev_virtio_testsuite = {
>>   	}
>>   };
>>
>> -static struct unit_test_suite cryptodev_caam_jr_testsuite  = {
>> -	.suite_name = "Crypto CAAM JR Unit Test Suite",
>> -	.setup = testsuite_setup,
>> -	.teardown = testsuite_teardown,
>> +static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = {
>> +	.suite_name = "Crypto CAAM JR Sub Unit Test Suite",
>>   	.unit_test_cases = {
>>   		TEST_CASE_ST(ut_setup, ut_teardown,
>> -			     test_device_configure_invalid_dev_id),
>> -		TEST_CASE_ST(ut_setup, ut_teardown,
>> -			     test_multi_session),
>> +				test_device_configure_invalid_dev_id),
>> +		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
>>
>>   		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
>>   		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
>> @@ -13955,58 +14124,28 @@ static struct unit_test_suite
>> cryptodev_caam_jr_testsuite  = {
>>   	}
>>   };
> 
> Splitting the complete testsuite into logical generic algo based sub testsuite
> Is a good idea. I appreciate that.
> 
> But introducing PMD based test suite is not recommended. We have been
> trying from past few releases to clean this up. And this patch is again introducing
> the same. When I first saw this series, I saw only the algo based splitting and
> when it was run on the board, it was showing results in an organized way.
> But this was not expected that, PMD based test suites are reintroduced by
> Intel who helped in removing them in last few releases.
> 
> This will make an unnecessary addition of duplicate code whenever a new PMD
> is introduced.
> 
> I recommend to use a single parent suite - cryptodev_testsuite and there
> Can be multiple sub testsuites based on Algos etc. but not on the basis of PMD.
> 
> Regards,
> Akhil
> 

Hey Akhil, I understand the sentiment of this, we were just trying to 
avoid necessary failures by executing testsuites which aren't supported 
by the PMD under test, and we're confident that all testsuites/tests are 
correctly verifying their capabilities requirements. If we add some code 
into the testsuite setup functions to test capabilities required for the 
testsuites vs those required by the PMD then we could do as you are 
suggesting. If we can make this change quickly would you consider this 
patchset for inclusion in RC2?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
  2021-04-14 11:12     ` Doherty, Declan
@ 2021-04-14 11:18       ` Akhil Goyal
  2021-04-14 11:20         ` Thomas Monjalon
  0 siblings, 1 reply; 17+ messages in thread
From: Akhil Goyal @ 2021-04-14 11:18 UTC (permalink / raw)
  To: Doherty, Declan, Ciara Power, dev
  Cc: aconole, hemant.agrawal, Anoob Joseph, ruifeng.wang, asomalap,
	ajit.khaparde, g.singh, Matan Azrad, NBU-Contact-Thomas Monjalon

Hi Declan,

> > //snip
> >
> >>   	nb_devs = rte_cryptodev_count();
> >>   	if (nb_devs < 1) {
> >>   		RTE_LOG(WARNING, USER1, "No crypto devices found?\n");
> >> @@ -838,6 +630,228 @@ testsuite_setup(void)
> >>   	return TEST_SUCCESS;
> >>   }
> >>
> >> +static int
> >> +qat_testsuite_setup(void)
> >> +{
> >> +	return testsuite_params_setup();
> >> +}
> >> +
> >> +static int
> >> +aesni_mb_testsuite_setup(void)
> >> +{
> >> +	int32_t nb_devs, ret;
> >> +	nb_devs = rte_cryptodev_device_count_by_driver(
> >> +			rte_cryptodev_driver_id_get(
> >> +			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
> >> +	if (nb_devs < 1) {
> >> +		ret =
> >> rte_vdev_init(RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
> >> +
> >> +		TEST_ASSERT(ret == 0,
> >> +			"Failed to create instance of pmd : %s",
> >> +			RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
> >> +	}
> >> +	return testsuite_params_setup();
> >> +}
> >
> > Why is it required to have a separate function for each of the PMD?
> > I believe a single function with an argument should be sufficient.
> > And in that single function a simple switch case may process the vdevs
> differently.
> >
> > As of now, it looks that moving the unnecessary duplicate code from
> > one place to another.
> >
> > This was one cleanup we have been looking forward to from quite some
> time.
> > Every time a new PMD comes, a separate function is formed and the length
> of
> > the code increases.
> >
> >
> > //snip
> 
> The virtual device creation code could be dropped completely if user is
> guaranteed to create the required crypto PMD from EAL devargs and we
> could assume that the first crypto device of the test suite type is
> always used?

Agreed.
 
> 
> >>
> >> -static struct unit_test_suite cryptodev_virtio_testsuite = {
> >> +static struct unit_test_suite cryptodev_virtio_sub_testsuite = {
> >>   	.suite_name = "Crypto VIRTIO Unit Test Suite",
> >> -	.setup = testsuite_setup,
> >> -	.teardown = testsuite_teardown,
> >>   	.unit_test_cases = {
> >>   		TEST_CASE_ST(ut_setup, ut_teardown,
> >> test_AES_cipheronly_all),
> >>
> >> @@ -13935,15 +14107,12 @@ static struct unit_test_suite
> >> cryptodev_virtio_testsuite = {
> >>   	}
> >>   };
> >>
> >> -static struct unit_test_suite cryptodev_caam_jr_testsuite  = {
> >> -	.suite_name = "Crypto CAAM JR Unit Test Suite",
> >> -	.setup = testsuite_setup,
> >> -	.teardown = testsuite_teardown,
> >> +static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = {
> >> +	.suite_name = "Crypto CAAM JR Sub Unit Test Suite",
> >>   	.unit_test_cases = {
> >>   		TEST_CASE_ST(ut_setup, ut_teardown,
> >> -			     test_device_configure_invalid_dev_id),
> >> -		TEST_CASE_ST(ut_setup, ut_teardown,
> >> -			     test_multi_session),
> >> +				test_device_configure_invalid_dev_id),
> >> +		TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
> >>
> >>   		TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
> >>   		TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
> >> @@ -13955,58 +14124,28 @@ static struct unit_test_suite
> >> cryptodev_caam_jr_testsuite  = {
> >>   	}
> >>   };
> >
> > Splitting the complete testsuite into logical generic algo based sub testsuite
> > Is a good idea. I appreciate that.
> >
> > But introducing PMD based test suite is not recommended. We have been
> > trying from past few releases to clean this up. And this patch is again
> introducing
> > the same. When I first saw this series, I saw only the algo based splitting
> and
> > when it was run on the board, it was showing results in an organized way.
> > But this was not expected that, PMD based test suites are reintroduced by
> > Intel who helped in removing them in last few releases.
> >
> > This will make an unnecessary addition of duplicate code whenever a new
> PMD
> > is introduced.
> >
> > I recommend to use a single parent suite - cryptodev_testsuite and there
> > Can be multiple sub testsuites based on Algos etc. but not on the basis of
> PMD.
> >
> > Regards,
> > Akhil
> >
> 
> Hey Akhil, I understand the sentiment of this, we were just trying to
> avoid necessary failures by executing testsuites which aren't supported
> by the PMD under test, and we're confident that all testsuites/tests are
> correctly verifying their capabilities requirements. If we add some code
> into the testsuite setup functions to test capabilities required for the
> testsuites vs those required by the PMD then we could do as you are
> suggesting. If we can make this change quickly would you consider this
> patchset for inclusion in RC2?

I can take these patches upto RC2.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
  2021-04-14 11:18       ` Akhil Goyal
@ 2021-04-14 11:20         ` Thomas Monjalon
  2021-04-14 11:22           ` Akhil Goyal
  0 siblings, 1 reply; 17+ messages in thread
From: Thomas Monjalon @ 2021-04-14 11:20 UTC (permalink / raw)
  To: Doherty, Declan, Ciara Power, Akhil Goyal
  Cc: dev, aconole, hemant.agrawal, Anoob Joseph, ruifeng.wang,
	asomalap, ajit.khaparde, g.singh, Matan Azrad

14/04/2021 13:18, Akhil Goyal:
> > > Splitting the complete testsuite into logical generic algo based sub testsuite
> > > Is a good idea. I appreciate that.
> > >
> > > But introducing PMD based test suite is not recommended. We have been
> > > trying from past few releases to clean this up. And this patch is again
> > introducing
> > > the same. When I first saw this series, I saw only the algo based splitting
> > and
> > > when it was run on the board, it was showing results in an organized way.
> > > But this was not expected that, PMD based test suites are reintroduced by
> > > Intel who helped in removing them in last few releases.
> > >
> > > This will make an unnecessary addition of duplicate code whenever a new
> > PMD
> > > is introduced.
> > >
> > > I recommend to use a single parent suite - cryptodev_testsuite and there
> > > Can be multiple sub testsuites based on Algos etc. but not on the basis of
> > PMD.
> > >
> > > Regards,
> > > Akhil
> > >
> > 
> > Hey Akhil, I understand the sentiment of this, we were just trying to
> > avoid necessary failures by executing testsuites which aren't supported
> > by the PMD under test, and we're confident that all testsuites/tests are
> > correctly verifying their capabilities requirements. If we add some code
> > into the testsuite setup functions to test capabilities required for the
> > testsuites vs those required by the PMD then we could do as you are
> > suggesting. If we can make this change quickly would you consider this
> > patchset for inclusion in RC2?
> 
> I can take these patches upto RC2.

Please don't merge patches which go in the wrong direction.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
  2021-04-14 11:20         ` Thomas Monjalon
@ 2021-04-14 11:22           ` Akhil Goyal
  0 siblings, 0 replies; 17+ messages in thread
From: Akhil Goyal @ 2021-04-14 11:22 UTC (permalink / raw)
  To: Thomas Monjalon, Doherty, Declan, Ciara Power
  Cc: dev, aconole, hemant.agrawal, Anoob Joseph, ruifeng.wang,
	asomalap, ajit.khaparde, g.singh, Matan Azrad

> > > > Splitting the complete testsuite into logical generic algo based sub
> testsuite
> > > > Is a good idea. I appreciate that.
> > > >
> > > > But introducing PMD based test suite is not recommended. We have
> been
> > > > trying from past few releases to clean this up. And this patch is again
> > > introducing
> > > > the same. When I first saw this series, I saw only the algo based splitting
> > > and
> > > > when it was run on the board, it was showing results in an organized
> way.
> > > > But this was not expected that, PMD based test suites are reintroduced
> by
> > > > Intel who helped in removing them in last few releases.
> > > >
> > > > This will make an unnecessary addition of duplicate code whenever a
> new
> > > PMD
> > > > is introduced.
> > > >
> > > > I recommend to use a single parent suite - cryptodev_testsuite and
> there
> > > > Can be multiple sub testsuites based on Algos etc. but not on the basis
> of
> > > PMD.
> > > >
> > > > Regards,
> > > > Akhil
> > > >
> > >
> > > Hey Akhil, I understand the sentiment of this, we were just trying to
> > > avoid necessary failures by executing testsuites which aren't supported
> > > by the PMD under test, and we're confident that all testsuites/tests are
> > > correctly verifying their capabilities requirements. If we add some code
> > > into the testsuite setup functions to test capabilities required for the
> > > testsuites vs those required by the PMD then we could do as you are
> > > suggesting. If we can make this change quickly would you consider this
> > > patchset for inclusion in RC2?
> >
> > I can take these patches upto RC2.
> 
> Please don't merge patches which go in the wrong direction.
> 
I agreed to take patches by RC2, if above comments are addressed.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-04-14 11:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 14:24 [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ciara Power
2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner Ciara Power
2021-04-05 12:10   ` Aaron Conole
2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format Ciara Power
2021-04-05 12:30   ` Aaron Conole
2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites Ciara Power
2021-04-13 17:51   ` [dpdk-dev] [EXT] " Akhil Goyal
2021-04-13 18:17     ` Thomas Monjalon
2021-04-14 11:12     ` Doherty, Declan
2021-04-14 11:18       ` Akhil Goyal
2021-04-14 11:20         ` Thomas Monjalon
2021-04-14 11:22           ` Akhil Goyal
2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 4/6] test/crypto: move testsuite params to header file Ciara Power
2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 5/6] test/crypto: fix return value on test skipped Ciara Power
2021-04-13 17:07   ` [dpdk-dev] [EXT] " Akhil Goyal
2021-04-02 14:24 ` [dpdk-dev] [PATCH v2 6/6] test/crypto: dynamically build blockcipher suite Ciara Power
2021-04-06  1:34 ` [dpdk-dev] [PATCH v2 0/6] test: refactor crypto unit test framework Ruifeng Wang

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).