DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH 5/6] test/crypto: dynamically build blockcipher suite
@ 2021-03-31 14:46 Akhil Goyal
  2021-04-02 14:34 ` Power, Ciara
  0 siblings, 1 reply; 3+ messages in thread
From: Akhil Goyal @ 2021-03-31 14:46 UTC (permalink / raw)
  To: Ciara Power, dev
  Cc: declan.doherty, hemant.agrawal, Anoob Joseph, ruifeng.wang,
	asomalap, ajit.khaparde, g.singh, aconole

Hi Ciara,

Nice work. I have below comment on the output of the results.

++ more crypto PMD maintainers.

> 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>
> ---
When I run the patchset, The output I got is 
+ Sub Testsuites Total :       24 
 + Sub Testsuites Skipped :      2
 + Sub Testsuites Passed :      22
 + Sub Testsuites Failed :       0      

Is it possible for you to give more details in the end like 
Number of tests passed/failed/skipped/unsupported as well for each of the suite.

The reason is that, people normally check the report in the end.
For example: 
Crypto General(A/X passed, B/X skipped, C/X failed)
//one line for each of the suite.


Regards,
Akhil

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

* Re: [dpdk-dev] [PATCH 5/6] test/crypto: dynamically build blockcipher suite
  2021-03-31 14:46 [dpdk-dev] [PATCH 5/6] test/crypto: dynamically build blockcipher suite Akhil Goyal
@ 2021-04-02 14:34 ` Power, Ciara
  0 siblings, 0 replies; 3+ messages in thread
From: Power, Ciara @ 2021-04-02 14:34 UTC (permalink / raw)
  To: Akhil Goyal, dev
  Cc: Doherty, Declan, hemant.agrawal, Anoob Joseph, ruifeng.wang,
	asomalap, ajit.khaparde, g.singh, aconole

Hi Akhil,


>-----Original Message-----
>From: Akhil Goyal <gakhil@marvell.com>
>Sent: Wednesday 31 March 2021 15:46
>To: Power, Ciara <ciara.power@intel.com>; dev@dpdk.org
>Cc: Doherty, Declan <declan.doherty@intel.com>; hemant.agrawal@nxp.com;
>Anoob Joseph <anoobj@marvell.com>; ruifeng.wang@arm.com;
>asomalap@amd.com; ajit.khaparde@broadcom.com; g.singh@nxp.com;
>aconole@redhat.com
>Subject: RE: [dpdk-dev] [PATCH 5/6] test/crypto: dynamically build
>blockcipher suite
>
>Hi Ciara,
>
>Nice work. I have below comment on the output of the results.
>
>++ more crypto PMD maintainers.
>
>> 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>
>> ---
>When I run the patchset, The output I got is
>+ Sub Testsuites Total :       24
> + Sub Testsuites Skipped :      2
> + Sub Testsuites Passed :      22
> + Sub Testsuites Failed :       0
>
>Is it possible for you to give more details in the end like Number of tests
>passed/failed/skipped/unsupported as well for each of the suite.
>
>The reason is that, people normally check the report in the end.
>For example:
>Crypto General(A/X passed, B/X skipped, C/X failed) //one line for each of the
>suite.
>
>
>Regards,
>Akhil

Yes, that is a good suggestion.
I have added this extra detail in the v2.
https://patchwork.dpdk.org/project/dpdk/list/?series=16085

Thanks!




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

* [dpdk-dev] [PATCH 5/6] test/crypto: dynamically build blockcipher suite
  2021-03-16 14:32 [dpdk-dev] [PATCH 0/6] test: refactor crypto unit test framework Ciara Power
@ 2021-03-16 14:32 ` Ciara Power
  0 siblings, 0 replies; 3+ messages in thread
From: Ciara Power @ 2021-03-16 14:32 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, 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>
---
 app/test/test.c                       |  12 +-
 app/test/test.h                       |  16 +-
 app/test/test_cryptodev.c             | 511 +++++++++++++++-----------
 app/test/test_cryptodev_blockcipher.c | 121 +++---
 app/test/test_cryptodev_blockcipher.h |  12 +-
 5 files changed, 398 insertions(+), 274 deletions(-)

diff --git a/app/test/test.c b/app/test/test.c
index fe40a91f97..23ec3a529b 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -223,7 +223,7 @@ unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite,
 				skipped, failed);
 	} else {
 		tc = suite->unit_test_cases[tc_count];
-		while (tc.testcase) {
+		while (tc.testcase || tc.testcase_with_data) {
 			if (!tc.enabled ||
 			test_success == TEST_SKIPPED)
 				(*skipped)++;
@@ -281,7 +281,7 @@ unit_test_suite_runner(struct unit_test_suite *suite)
 		}
 	} else {
 		tc = suite->unit_test_cases[total];
-		while (tc.testcase) {
+		while (tc.testcase || tc.testcase_with_data) {
 			if (!tc.enabled) {
 				skipped++;
 				total++;
@@ -299,7 +299,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)
 					succeeded++;
 				else if (test_success == TEST_SKIPPED)
diff --git a/app/test/test.h b/app/test/test.h
index 3fdac56631..d3b06f4557 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 6cfd866f2f..6a9faf7ec3 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,
@@ -13364,14 +13299,6 @@ static const 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,
@@ -14102,15 +14029,6 @@ static const 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 = ((struct unit_test_case []) {
-		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",
 	.parent_testsuite = false,
@@ -14119,38 +14037,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 = ((struct unit_test_case []) {
-		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 = ((struct unit_test_case []) {
-		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 */
 	})
 };
@@ -14158,7 +14044,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,
@@ -14193,11 +14088,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;
 }
@@ -14205,9 +14102,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 = {
@@ -14225,11 +14124,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;
 }
@@ -14237,7 +14138,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,
@@ -14273,11 +14183,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;
 }
@@ -14286,8 +14198,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,
@@ -14323,13 +14244,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;
@@ -14338,7 +14261,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,
@@ -14374,11 +14306,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;
 }
@@ -14386,7 +14320,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,
@@ -14422,11 +14365,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;
 }
@@ -14435,8 +14380,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,
@@ -14472,13 +14426,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;
@@ -14487,7 +14443,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,
@@ -14523,11 +14488,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;
 }
@@ -14535,7 +14502,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,
@@ -14571,11 +14547,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;
 }
@@ -14583,7 +14561,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,
@@ -14619,11 +14606,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;
 }
@@ -14631,7 +14620,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,
@@ -14667,11 +14665,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;
 }
@@ -14679,7 +14679,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,
@@ -14715,11 +14724,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;
 }
@@ -14727,7 +14738,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};
 	const struct unit_test_suite static_suites[] = {
 		cryptodev_multi_session_testsuite,
 		cryptodev_null_testsuite,
@@ -14745,7 +14762,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 = {
@@ -14764,11 +14780,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;
 }
@@ -14778,63 +14796,36 @@ 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
+	};
 	struct unit_test_suite sched_mode_suites[] = {
 		{
 			.suite_name = "Scheduler Multicore Unit Test Suite",
 			.setup = scheduler_multicore_testsuite_setup,
 			.teardown = scheduler_mode_testsuite_teardown,
-			.unit_test_cases = ((struct unit_test_case []) {
-				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()
-			})
+			.parent_testsuite = true
 		},
 		{
 			.suite_name = "Scheduler Round Robin Unit Test Suite",
 			.setup = scheduler_roundrobin_testsuite_setup,
 			.teardown = scheduler_mode_testsuite_teardown,
-			.unit_test_cases = ((struct unit_test_case []) {
-				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()
-			})
+			.parent_testsuite = true
 		},
 		{
 			.suite_name = "Scheduler Failover Unit Test Suite",
 			.setup = scheduler_failover_testsuite_setup,
 			.teardown = scheduler_mode_testsuite_teardown,
-			.unit_test_cases = ((struct unit_test_case []) {
-				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()
-			})
+			.parent_testsuite = true
 		},
 		{
 			.suite_name = "Scheduler Pkt Size Distr Unit Test Suite",
 			.setup = scheduler_pkt_size_distr_testsuite_setup,
 			.teardown = scheduler_mode_testsuite_teardown,
-			.unit_test_cases = ((struct unit_test_case []) {
-				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()
-			})
+			.parent_testsuite = true
 		}
 	};
 	struct unit_test_suite static_suites[] = {
@@ -14875,6 +14866,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,
@@ -14882,6 +14883,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;
 }
@@ -14893,7 +14900,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,
@@ -14929,11 +14945,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;
 }
@@ -14941,7 +14959,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,
@@ -14977,11 +15004,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;
 }
@@ -14989,11 +15018,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 = {
@@ -15012,11 +15046,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;
 }
@@ -15024,7 +15060,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,
@@ -15060,11 +15105,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;
 }
@@ -15072,7 +15119,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,
@@ -15108,11 +15164,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;
 }
@@ -15120,7 +15178,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
@@ -15141,11 +15205,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;
 }
@@ -15153,7 +15219,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,
@@ -15189,11 +15264,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;
 }
@@ -15201,7 +15278,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,
@@ -15237,11 +15323,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;
 }
@@ -15250,7 +15338,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,
@@ -15286,11 +15381,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 135e57b9fa..5c32564199 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -738,82 +738,101 @@ 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 = {0};
+	const struct blockcipher_test_case *blk_tcs;
+	struct unit_test_case *tcs;
 
 	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.suite_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.suite_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.suite_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.suite_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.suite_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.suite_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.suite_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.suite_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);
+	tcs = malloc(sizeof(struct unit_test_case) * (n_test_cases + 1));
 
-		if (status == TEST_FAILED) {
-			overall_status = status;
-
-			if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
-				break;
-		}
+	for (i = 0; i < n_test_cases; i++) {
+		tcs[i].name = blk_tcs[i].test_descr;
+		tcs[i].enabled = 1;
+		tcs[i].setup = ut_setup;
+		tcs[i].teardown = ut_teardown;
+		tcs[i].testcase = NULL;
+		tcs[i].testcase_with_data = blockcipher_test_case_run;
+		tcs[i].data = &blk_tcs[i];
 	}
+	tcs[i].name = NULL;
+	tcs[i].enabled = 0;
+	tcs[i].setup = NULL;
+	tcs[i].teardown = NULL;
+	tcs[i].testcase = NULL;
+	tcs[i].testcase_with_data = NULL;
+	tcs[i].data = NULL;
+	ts.unit_test_cases = tcs;
+
+	return ts;
+}
 
-	return overall_status;
+void
+free_blockcipher_test_suite(struct unit_test_suite *ts)
+{
+	free(ts->unit_test_cases);
 }
diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h
index 8990716844..ebdd806776 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_ */
-- 
2.25.1


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 14:46 [dpdk-dev] [PATCH 5/6] test/crypto: dynamically build blockcipher suite Akhil Goyal
2021-04-02 14:34 ` Power, Ciara
  -- strict thread matches above, loose matches on Subject: below --
2021-03-16 14:32 [dpdk-dev] [PATCH 0/6] test: refactor crypto unit test framework Ciara Power
2021-03-16 14:32 ` [dpdk-dev] [PATCH 5/6] test/crypto: dynamically build blockcipher suite Ciara Power

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git