test: refactor crypto unit test framework
cover test: refactor crypto unit test framework
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/[email protected]/
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: dynamically build blockcipher suite
doc: add unit test suite change to release notes
app/test/test.c | 168 +- app/test/test.h | 22 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 2020 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 105 +- app/test/test_cryptodev_blockcipher.c | 121 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 36 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- doc/guides/rel_notes/release_21_05.rst | 5 + 36 files changed, 1898 insertions(+), 739 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/6 app/test: refactor of unit test suite runner
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.
The summary output now prints the suite name, this will be useful later when multiple nested sub-testsuites are being run.
--- app/test/test.c | 51 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 18 deletions(-)
app/test/test.c +33 -18
@@ -207,6 +207,23 @@ 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,unsigned int *total,unsigned int *skipped, +unsigned int *failed) +{ +struct unit_test_case tc; + + tc = suite->unit_test_cases[*total]; +while (tc.testcase) { +if (!tc.enabled || test_success ==TEST_SKIPPED ) + (*skipped)++; +else + (*failed)++; + (*total)++; + tc = suite->unit_test_cases[*total]; + } +}int unit_test_suite_runner (struct unit_test_suite *suite)
@@ -215,6 +232,7 @@ unit_test_suite_runner(struct unit_test_suite *suite)unsigned int total =0 , executed =0 , skipped =0 ;unsigned int succeeded =0 , failed =0 , unsupported =0 ;const char *status; +struct unit_test_case tc;if (suite->suite_name) {printf (" + ------------------------------------------------------- +\n" );
@@ -228,38 +246,35 @@ 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, &total, + &skipped, &failed); goto suite_summary; } }printf (" + ------------------------------------------------------- +\n" ); -while (suite->unit_test_cases[total].testcase) { -if (!suite->unit_test_cases[total].enabled) { + tc = suite->unit_test_cases[total]; +while (tc.testcase) { +if (!tc.enabled) { skipped++; total++; + tc = suite->unit_test_cases[total];continue ; }else { 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++;else if (test_success ==TEST_SKIPPED )
@@ -275,8 +290,8 @@ unit_test_suite_runner(struct unit_test_suite *suite) }/* 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 +302,10 @@ 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); +printf (" + TestCase [%2d] : %s %s\n" , total, tc.name, status); total++; + tc = suite->unit_test_cases[total]; }/* Run test suite teardown */
@@ -301,7 +316,7 @@ unit_test_suite_runner(struct unit_test_suite *suite) suite_summary:printf (" + ------------------------------------------------------- +\n" ); -printf (" + Test Suite Summary \n" ); +printf (" + Test Suite Summary : %s\n" , suite->suite_name);printf (" + Tests Total : %2d\n" , total);printf (" + Tests Skipped : %2d\n" , skipped);printf (" + Tests Executed : %2d\n" , executed);
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH 1/6] app/test: refactor of unit test suite runner
Quoted 12 lines · 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.
Quoted 5 lines
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 <[email protected]>---
I see lots of open coded loops in here. Does it make sense to have something like:
#define FOR_EACH_SUITE_TESTCASE(iter, suite, case) \
for (iter = 0, case = suite->unit_test_case[0]; \
suite->unit_test_cases[iter]; \
iter++, case = suite->unit_test_cases[iter])Then in code we can do:
struct unit_test_case tc;
size_t total;
FOR_EACH_SUITE_TESTCASE(total, suite, tc) {
... check something ...
}It would help reading the patch.
Quoted 121 lines
app/test/test.c | 51 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 18 deletions(-)app/test/test.c +33
-18@@ -207,6 +207,23 @@ 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,unsigned int *total,unsigned int *skipped, +unsigned int *failed) +{ +struct unit_test_case tc; + + tc = suite->unit_test_cases[*total]; +while (tc.testcase) { +if (!tc.enabled || test_success ==TEST_SKIPPED ) + (*skipped)++; +else + (*failed)++; + (*total)++; + tc = suite->unit_test_cases[*total]; + } +}int unit_test_suite_runner (struct unit_test_suite *suite)@@ -215,6 +232,7 @@ unit_test_suite_runner(struct unit_test_suite *suite)unsigned int total =0 , executed =0 , skipped =0 ;unsigned int succeeded =0 , failed =0 , unsupported =0 ;const char *status; +struct unit_test_case tc;if (suite->suite_name) {printf (" + ------------------------------------------------------- +\n" );@@ -228,38 +246,35 @@ 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, &total, + &skipped, &failed); goto suite_summary; } }printf (" + ------------------------------------------------------- +\n" ); -while (suite->unit_test_cases[total].testcase) { -if (!suite->unit_test_cases[total].enabled) { + tc = suite->unit_test_cases[total]; +while (tc.testcase) { +if (!tc.enabled) { skipped++; total++; + tc = suite->unit_test_cases[total];continue ; }else { 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++;else if (test_success ==TEST_SKIPPED )@@ -275,8 +290,8 @@ unit_test_suite_runner(struct unit_test_suite *suite) }/* 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 +302,10 @@ 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); +printf (" + TestCase [%2d] : %s %s\n" , total, tc.name, status); total++; + tc = suite->unit_test_cases[total]; }/* Run test suite teardown */ @@ -301,7 +316,7 @@ unit_test_suite_runner(struct unit_test_suite *suite) suite_summary:printf (" + ------------------------------------------------------- +\n" ); -printf (" + Test Suite Summary \n" ); +printf (" + Test Suite Summary : %s\n" , suite->suite_name);printf (" + Tests Total : %2d\n" , total);printf (" + Tests Skipped : %2d\n" , skipped);printf (" + Tests Executed : %2d\n" , executed);
PATCH 2/6 test: introduce parent testsuite format
In reply to Ciara PowerThe 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 either a pointer to a list of test cases, or a pointer to a list of sub-testsuites. A bool value is also introduced here to indicate whether the testsuite is a parent suite or not.
--- app/test/test.c | 151 ++++++++++++++++++--------- app/test/test.h | 6 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 24 ++--- app/test/test_cryptodev_asym.c | 12 +-- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 4 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- 32 files changed, 188 insertions(+), 137 deletions(-)
app/test/test.c +99 -52
@@ -213,24 +213,37 @@ unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite, unsigned int *failed) {struct unit_test_case tc; - - tc = suite->unit_test_cases[*total]; -while (tc.testcase) { -if (!tc.enabled || test_success ==TEST_SKIPPED ) - (*skipped)++; -else - (*failed)++; - (*total)++; - tc = suite->unit_test_cases[*total]; +int i, tc_count =0 ; + +if (suite->parent_testsuite) { +for (i =0 ; suite->unit_test_suites[i].suite_name !=NULL ; i++) +unit_test_suite_count_tcs_on_setup_fail ( + &suite->unit_test_suites[i], + test_success, total, + skipped, failed); + }else { + tc = suite->unit_test_cases[tc_count]; +while (tc.testcase) { +if (!tc.enabled || + test_success ==TEST_SKIPPED ) + (*skipped)++; +else + (*failed)++; + tc_count++; + tc = suite->unit_test_cases[tc_count]; + } + *total += tc_count; } }int unit_test_suite_runner (struct unit_test_suite *suite) { -int test_success; +int test_success, i, ret;unsigned int total =0 , executed =0 , skipped =0 ;unsigned int succeeded =0 , failed =0 , unsupported =0 ; +unsigned int sub_ts_succeeded =0 , sub_ts_failed =0 ; +unsigned int sub_ts_skipped =0 , sub_ts_total =0 ;const char *status;struct unit_test_case tc;
@@ -255,63 +268,80 @@ unit_test_suite_runner(struct unit_test_suite *suite)printf (" + ------------------------------------------------------- +\n" ); - tc = suite->unit_test_cases[total]; -while (tc.testcase) { -if (!tc.enabled) { - skipped++; - total++; - tc = suite->unit_test_cases[total]; -continue ; - }else { - executed++; +if (suite->parent_testsuite) { +for (i =0 ; suite->unit_test_suites[i].suite_name !=NULL ; i++) { + ret =unit_test_suite_runner (&suite->unit_test_suites[i]); +if (ret ==TEST_SUCCESS ) + sub_ts_succeeded++; +else if (ret ==TEST_SKIPPED ) + sub_ts_skipped++; +else + sub_ts_failed++; + sub_ts_total++; } + }else { + tc = suite->unit_test_cases[total]; +while (tc.testcase) { +if (!tc.enabled) { + skipped++; + total++; + tc = suite->unit_test_cases[total]; +continue ; + }else { + 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 ) + succeeded++; +else if (test_success ==TEST_SKIPPED ) + skipped++; +else if (test_success == -ENOTSUP ) + unsupported++; +else + failed++; + }else if (test_success == -ENOTSUP ) { + unsupported++; + }else { + 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 ) - succeeded++; + status ="succeeded" ;else if (test_success ==TEST_SKIPPED ) - skipped++; + status ="skipped" ;else if (test_success == -ENOTSUP ) - unsupported++; + status ="unsupported" ;else - failed++; - }else if (test_success == -ENOTSUP ) { - unsupported++; - }else { - 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" ; + status ="failed" ; -printf (" + TestCase [%2d] : %s %s\n" , total, tc.name, status); +printf (" + TestCase [%2d] : %s %s\n" , total, + tc.name, status); - total++; - tc = suite->unit_test_cases[total]; + total++; + tc = suite->unit_test_cases[total]; + } }/* Run test suite teardown */ if (suite->teardown) suite->teardown (); +if (suite->parent_testsuite) + goto parent_suite_summary; + goto suite_summary; suite_summary:
@@ -332,4 +362,21 @@ unit_test_suite_runner(struct unit_test_suite *suite)if (total == skipped)return TEST_SKIPPED ;return TEST_SUCCESS ; + +parent_suite_summary: +printf (" + ------------------------------------------------------- +\n" ); +printf (" + Parent Test Suite Summary : %s\n" , suite->suite_name); +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" ); + + last_test_result = failed; + +if (sub_ts_failed) +return TEST_FAILED ; +if (sub_ts_total == sub_ts_skipped) +return TEST_SKIPPED ; +return TEST_SUCCESS ; }
app/test/test.h +5 -1
@@ -138,7 +138,11 @@ struct unit_test_suite {const char *suite_name;int (*setup)(void );void (*teardown)(void ); -struct unit_test_case unit_test_cases[]; +bool parent_testsuite; +union { +struct unit_test_case *unit_test_cases; +struct unit_test_suite *unit_test_suites; + }; };int unit_test_suite_runner (struct unit_test_suite *suite);
app/test/test_bitratestats.c +2 -2
@@ -189,7 +189,7 @@ unit_test_suite bitratestats_testsuite = { .suite_name = "BitRate Stats Unit Test Suite", .setup = test_bit_ring_setup, .teardown = test_bit_ring_free, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { /* TEST CASE 1: Test to create bit rate data */ TEST_CASE(test_stats_bitrate_create),
@@ -231,7 +231,7 @@ unit_test_suite bitratestats_testsuite = {/* TEST CASE 9: Test to do the cleanup w.r.t create */ TEST_CASE (test_stats_bitrate_free),TEST_CASES_END () - } + }) }; static int
app/test/test_compressdev.c +2 -2
@@ -4183,7 +4183,7 @@ static struct unit_test_suite compressdev_testsuite = { .suite_name = "compressdev unit test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, test_compressdev_invalid_configuration), TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,
@@ -4261,7 +4261,7 @@ static struct unit_test_suite compressdev_testsuite = { test_compressdev_deflate_im_buffers_SGL_over_2ops_second),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_cryptodev.c +12 -12
@@ -13247,7 +13247,7 @@ 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 = { + .unit_test_cases = ((struct unit_test_case []) { /* Multi Core */ TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op), TEST_CASE_ST(NULL, NULL, test_scheduler_mode_multicore_op),
@@ -13281,7 +13281,7 @@ static struct unit_test_suite cryptodev_scheduler_testsuite = {TEST_CASE_ST (NULL ,NULL , test_scheduler_detach_slave_op),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };#endif /* RTE_CRYPTO_SCHEDULER */
@@ -13290,7 +13290,7 @@ static struct unit_test_suite cryptodev_testsuite = { .suite_name = "Crypto Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_device_configure_invalid_dev_id), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13921,25 +13921,25 @@ static struct unit_test_suite cryptodev_testsuite = { 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_virtio_testsuite = { .suite_name ="Crypto VIRTIO Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .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_testsuite = { .suite_name = "Crypto CAAM JR Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_device_configure_invalid_dev_id), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13952,14 +13952,14 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite = { 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_testsuite = { .suite_name ="Crypto Device Marvell Component Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session_random_usage),
@@ -13980,14 +13980,14 @@ static struct unit_test_suite cryptodev_mrvl_testsuite = { auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite cryptodev_ccp_testsuite = { .suite_name ="Crypto Device CCP Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session_random_usage),
@@ -14008,7 +14008,7 @@ static struct unit_test_suite cryptodev_ccp_testsuite = { auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_cryptodev_asym.c +6 -6
@@ -2288,7 +2288,7 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = { .suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { 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),
@@ -2300,24 +2300,24 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp), TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite cryptodev_qat_asym_testsuite = { .suite_name ="Crypto Device QAT ASYM Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_one_by_one),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite cryptodev_octeontx_asym_testsuite = { .suite_name ="Crypto Device OCTEONTX ASYM Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {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),
@@ -2326,7 +2326,7 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite = { test_ecdsa_sign_verify_all_curve),TEST_CASE_ST (ut_setup ,ut_teardown ,test_ecpm_all_curve ),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_ethdev_link.c +2 -2
@@ -148,13 +148,13 @@ static struct unit_test_suite link_status_testsuite = { .suite_name = "link status formatting", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_link_status_up_default),TEST_CASE (test_link_status_down_default),TEST_CASE (test_link_speed_all_values),TEST_CASE (test_link_status_invalid),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_event_crypto_adapter.c +2 -2
@@ -959,7 +959,7 @@ static struct unit_test_suite functional_testsuite = { .suite_name = "Event crypto adapter test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, test_crypto_adapter_free, test_crypto_adapter_create),
@@ -989,7 +989,7 @@ static struct unit_test_suite functional_testsuite = { test_sessionless_with_op_new_mode),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_event_eth_rx_adapter.c +4 -4
@@ -754,7 +754,7 @@ static struct unit_test_suite event_eth_rx_tests = { .suite_name = "rx event eth adapter test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, adapter_create_free), TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_add_del),
@@ -763,18 +763,18 @@ static struct unit_test_suite event_eth_rx_tests = { TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop), TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite event_eth_rx_intr_tests = { .suite_name ="rx event eth adapter test suite" , .setup = testsuite_setup_rx_intr, .teardown = testsuite_teardown_rx_intr, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (adapter_create, adapter_free, adapter_intr_queue_add_del),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_event_eth_tx_adapter.c +2 -2
@@ -680,7 +680,7 @@ static struct unit_test_suite event_eth_tx_tests = { .setup = testsuite_setup, .teardown = testsuite_teardown, .suite_name = "tx event eth adapter test suite", - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, tx_adapter_create_free), TEST_CASE_ST(tx_adapter_create, tx_adapter_free, tx_adapter_queue_add_del),
@@ -690,7 +690,7 @@ static struct unit_test_suite event_eth_tx_tests = { tx_adapter_service),TEST_CASE_ST (NULL ,NULL ,tx_adapter_dynamic_device ),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_event_timer_adapter.c +2 -2
@@ -1779,7 +1779,7 @@ static struct unit_test_suite event_timer_adptr_functional_testsuite = { .suite_name = "event timer functional test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(timdev_setup_usec, timdev_teardown, test_timer_state), TEST_CASE_ST(timdev_setup_usec, timdev_teardown,
@@ -1832,7 +1832,7 @@ static struct unit_test_suite event_timer_adptr_functional_testsuite = { adapter_tick_resolution),TEST_CASE (adapter_create_max ),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_eventdev.c +2 -2
@@ -934,7 +934,7 @@ static struct unit_test_suite eventdev_common_testsuite = { .suite_name = "eventdev common code unit test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, test_eventdev_count), TEST_CASE_ST(NULL, NULL,
@@ -984,7 +984,7 @@ static struct unit_test_suite eventdev_common_testsuite = { TEST_CASE_ST(eventdev_setup_device, NULL, test_eventdev_close),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_fbarray.c +2 -2
@@ -714,7 +714,7 @@ static struct unit_test_suite fbarray_test_suite = { .suite_name = "fbarray autotest", .setup = autotest_setup, .teardown = autotest_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_invalid), TEST_CASE(test_basic), TEST_CASE_ST(first_msk_test_setup, reset_array, test_find),
@@ -724,7 +724,7 @@ static struct unit_test_suite fbarray_test_suite = { TEST_CASE_ST(full_msk_test_setup, reset_array, test_find), TEST_CASE_ST(empty_msk_test_setup, reset_array, test_empty),TEST_CASES_END () - } + }) }; static int
app/test/test_fib.c +4 -4
@@ -375,24 +375,24 @@ static struct unit_test_suite fib_fast_tests = { .suite_name = "fib autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_create_invalid),TEST_CASE (test_free_null),TEST_CASE (test_add_del_invalid),TEST_CASE (test_get_invalid),TEST_CASE (test_lookup),TEST_CASES_END () - } + }) };static struct unit_test_suite fib_slow_tests = { .suite_name ="fib slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/*
app/test/test_fib6.c +4 -4
@@ -384,24 +384,24 @@ static struct unit_test_suite fib6_fast_tests = { .suite_name = "fib6 autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_create_invalid),TEST_CASE (test_free_null),TEST_CASE (test_add_del_invalid),TEST_CASE (test_get_invalid),TEST_CASE (test_lookup),TEST_CASES_END () - } + }) };static struct unit_test_suite fib6_slow_tests = { .suite_name ="fib6 slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/*
app/test/test_graph.c +2 -2
@@ -815,7 +815,7 @@ static struct unit_test_suite graph_testsuite = { .suite_name = "Graph library test suite", .setup = graph_setup, .teardown = graph_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_update_edges), TEST_CASE(test_lookup_functions), TEST_CASE(test_create_graph),
@@ -823,7 +823,7 @@ static struct unit_test_suite graph_testsuite = {TEST_CASE (test_graph_walk),TEST_CASE (test_print_stats ), TEST_CASES_END(), /**< NULL terminate unit test array */ - }, + }), }; static int
app/test/test_graph_perf.c +2 -2
@@ -1035,7 +1035,7 @@ static struct unit_test_suite graph_perf_testsuite = { .suite_name = "Graph library performance test suite", .setup = graph_perf_setup, .teardown = graph_perf_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(graph_init_hr, graph_fini, graph_hr_4s_1n_1src_1snk), TEST_CASE_ST(graph_init_hr_brst_one, graph_fini,
@@ -1051,7 +1051,7 @@ static struct unit_test_suite graph_perf_testsuite = { TEST_CASE_ST(graph_init_parallel_tree, graph_fini, graph_parallel_tree_5s_4n_4src_4snk), TEST_CASES_END(), /**< NULL terminate unit test array */ - }, + }), }; static int
app/test/test_ipfrag.c +2 -2
@@ -242,12 +242,12 @@ static struct unit_test_suite ipfrag_testsuite = { .suite_name = "IP Frag Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_ip_frag),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_ipsec.c +2 -2
@@ -2498,7 +2498,7 @@ static struct unit_test_suite ipsec_testsuite = { .suite_name = "IPsec NULL Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_ipsec_crypto_inb_burst_null_null_wrapper), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -2528,7 +2528,7 @@ static struct unit_test_suite ipsec_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_ipsec_crypto_inb_burst_2sa_4grp_null_null_wrapper),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_ipsec_sad.c +2 -2
@@ -864,7 +864,7 @@ static struct unit_test_suite ipsec_sad_tests = { .suite_name = "ipsec sad autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_invalid), TEST_CASE(test_find_existing), TEST_CASE(test_multiple_create),
@@ -875,7 +875,7 @@ static struct unit_test_suite ipsec_sad_tests = {TEST_CASE (test_lookup_adv),TEST_CASE (test_lookup_order ),TEST_CASES_END () - } + }) }; static int
app/test/test_latencystats.c +2 -2
@@ -171,7 +171,7 @@ unit_test_suite latencystats_testsuite = { .suite_name = "Latency Stats Unit Test Suite", .setup = test_latency_ring_setup, .teardown = test_latency_ring_free, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { /* Test Case 1: To check latency init with * metrics init
@@ -198,7 +198,7 @@ unit_test_suite latencystats_testsuite = { TEST_CASE_ST(NULL, NULL, test_latency_uninit),TEST_CASES_END () - } + }) };static int test_latencystats (void )
app/test/test_link_bonding.c +2 -2
@@ -5094,7 +5094,7 @@ static struct unit_test_suite link_bonding_test_suite = { .suite_name = "Link Bonding Unit Test Suite", .setup = test_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_bonded_device), TEST_CASE(test_create_bonded_device_with_invalid_params), TEST_CASE(test_add_slave_to_bonded_device),
@@ -5162,7 +5162,7 @@ static struct unit_test_suite link_bonding_test_suite = {TEST_CASE (test_close_bonded_device),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };
app/test/test_link_bonding_mode4.c +2 -2
@@ -1653,7 +1653,7 @@ static struct unit_test_suite link_bonding_mode4_test_suite = { .suite_name = "Link Bonding mode 4 Unit Test Suite", .setup = test_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_NAMED("test_mode4_agg_mode_selection", test_mode4_agg_mode_selection_wrapper), TEST_CASE_NAMED("test_mode4_lacp", test_mode4_lacp_wrapper),
@@ -1667,7 +1667,7 @@ static struct unit_test_suite link_bonding_mode4_test_suite = { test_mode4_ext_lacp_wrapper),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_link_bonding_rssconf.c +2 -2
@@ -645,13 +645,13 @@ test_rss_lazy_wrapper(void)static struct unit_test_suite link_bonding_rssconf_test_suite = { .suite_name ="RSS Dynamic Configuration for Bonding Unit Test Suite" , .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_NAMED ("test_setup" , test_setup_wrapper),TEST_CASE_NAMED ("test_rss" , test_rss_wrapper),TEST_CASE_NAMED ("test_rss_lazy" , test_rss_lazy_wrapper),TEST_CASES_END () - } + }) }; static int
app/test/test_metrics.c +2 -2
@@ -275,7 +275,7 @@ static struct unit_test_suite metrics_testsuite = { .suite_name = "Metrics Unit Test Suite", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { /* Test Case 1: Test to check all metric APIs without * metrics init */
@@ -317,7 +317,7 @@ static struct unit_test_suite metrics_testsuite = {TEST_CASE (test_metrics_deinitialize),TEST_CASES_END () - } + }) }; static int
app/test/test_pmd_ring.c +2 -2
@@ -576,7 +576,7 @@ unit_test_suite test_pmd_ring_suite = { .setup = test_pmd_ringcreate_setup, .teardown = test_cleanup_resources, .suite_name = "Test Pmd Ring Unit Test Suite", - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_ethdev_configure_ports), TEST_CASE(test_send_basic_packets), TEST_CASE(test_get_stats_for_port),
@@ -584,7 +584,7 @@ unit_test_suite test_pmd_ring_suite = {TEST_CASE (test_pmd_ring_pair_create_attach),TEST_CASE (test_command_line_ring_port ),TEST_CASES_END () - } + }) }; static int
app/test/test_reorder.c +2 -2
@@ -373,7 +373,7 @@ static struct unit_test_suite reorder_test_suite = { .setup = test_setup, .teardown = test_teardown, .suite_name = "Reorder Unit Test Suite", - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_reorder_create), TEST_CASE(test_reorder_init), TEST_CASE(test_reorder_find_existing),
@@ -381,7 +381,7 @@ static struct unit_test_suite reorder_test_suite = {TEST_CASE (test_reorder_insert),TEST_CASE (test_reorder_drain ),TEST_CASES_END () - } + }) }; static int
app/test/test_rib.c +4 -4
@@ -327,7 +327,7 @@ static struct unit_test_suite rib_tests = { .suite_name = "rib autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_invalid), TEST_CASE(test_free_null), TEST_CASE(test_insert_invalid),
@@ -335,17 +335,17 @@ static struct unit_test_suite rib_tests = {TEST_CASE (test_basic),TEST_CASE (test_tree_traversal ),TEST_CASES_END () - } + }) };static struct unit_test_suite rib_slow_tests = { .suite_name ="rib slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/*
app/test/test_rib6.c +4 -4
@@ -332,7 +332,7 @@ static struct unit_test_suite rib6_tests = { .suite_name = "rib6 autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_invalid), TEST_CASE(test_free_null), TEST_CASE(test_insert_invalid),
@@ -340,17 +340,17 @@ static struct unit_test_suite rib6_tests = {TEST_CASE (test_basic),TEST_CASE (test_tree_traversal ),TEST_CASES_END () - } + }) };static struct unit_test_suite rib6_slow_tests = { .suite_name ="rib6 slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/*
app/test/test_security.c +2 -2
@@ -2484,7 +2484,7 @@ static struct unit_test_suite security_testsuite = { .suite_name = "generic security", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_session_create_inv_context), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -2627,7 +2627,7 @@ static struct unit_test_suite security_testsuite = { test_capability_get_docsis_match),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_service_cores.c +2 -2
@@ -996,7 +996,7 @@ static struct unit_test_suite service_tests = { .suite_name = "service core test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(dummy_register, NULL, unregister_all), TEST_CASE_ST(dummy_register, NULL, service_name), TEST_CASE_ST(dummy_register, NULL, service_get_by_name),
@@ -1015,7 +1015,7 @@ static struct unit_test_suite service_tests = { TEST_CASE_ST(dummy_register, NULL, service_may_be_active), TEST_CASE_ST(dummy_register, NULL, service_active_two_cores),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static int
app/test/test_trace.c +2 -2
@@ -176,7 +176,7 @@ static struct unit_test_suite trace_tests = { .suite_name = "trace autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_trace_mode), TEST_CASE(test_generic_trace_points), TEST_CASE(test_fp_trace_points),
@@ -185,7 +185,7 @@ static struct unit_test_suite trace_tests = {TEST_CASE (test_trace_point_regex),TEST_CASE (test_trace_points_lookup ),TEST_CASES_END () - } + }) }; static int
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH 2/6] test: introduce parent testsuite format
Quoted 112 lines · 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 either a pointer to a list of test cases, or a pointer to a list of sub-testsuites. A bool value is also introduced here to indicate whether the testsuite is a parent suite or not.
Signed-off-by Ciara Power <[email protected]>--- app/test/test.c | 151 ++++++++++++++++++--------- app/test/test.h | 6 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 24 ++--- app/test/test_cryptodev_asym.c | 12 +-- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 4 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- 32 files changed, 188 insertions(+), 137 deletions(-)app/test/test.c +23
-19@@ -213,24 +213,37 @@ unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite, unsigned int *failed) {struct unit_test_case tc; - - tc = suite->unit_test_cases[*total]; -while (tc.testcase) { -if (!tc.enabled || test_success ==TEST_SKIPPED ) - (*skipped)++; -else - (*failed)++; - (*total)++; - tc = suite->unit_test_cases[*total]; +int i, tc_count =0 ; + +if (suite->parent_testsuite) { +for (i =0 ; suite->unit_test_suites[i].suite_name !=NULL ; i++) +unit_test_suite_count_tcs_on_setup_fail ( + &suite->unit_test_suites[i], + test_success, total, + skipped, failed); + }else { + tc = suite->unit_test_cases[tc_count]; +while (tc.testcase) { +if (!tc.enabled || + test_success ==TEST_SKIPPED ) + (*skipped)++; +else + (*failed)++; + tc_count++; + tc = suite->unit_test_cases[tc_count]; + } + *total += tc_count; } }int unit_test_suite_runner (struct unit_test_suite *suite) { -int test_success; +int test_success, i, ret;unsigned int total =0 , executed =0 , skipped =0 ;unsigned int succeeded =0 , failed =0 , unsupported =0 ; +unsigned int sub_ts_succeeded =0 , sub_ts_failed =0 ; +unsigned int sub_ts_skipped =0 , sub_ts_total =0 ;const char *status;struct unit_test_case tc;@@ -255,63 +268,80 @@ unit_test_suite_runner(struct unit_test_suite *suite)printf (" + ------------------------------------------------------- +\n" ); - tc = suite->unit_test_cases[total]; -while (tc.testcase) { -if (!tc.enabled) { - skipped++; - total++; - tc = suite->unit_test_cases[total]; -continue ; - }else { - executed++;
app/test/test.c unit_test_suite_runner(struct unit_test_suite *suite) · line 280
Quoted 10 lines
app/test/test.c +10
-0+if (suite->parent_testsuite) { +for (i =0 ; suite->unit_test_suites[i].suite_name !=NULL ; i++) { + ret =unit_test_suite_runner (&suite->unit_test_suites[i]); +if (ret ==TEST_SUCCESS ) + sub_ts_succeeded++; +else if (ret ==TEST_SKIPPED ) + sub_ts_skipped++; +else + sub_ts_failed++; + sub_ts_total++;
I suggest adding these counts to the test suite object itself - that way we can track them separately. And we can clear them when we jump into the unit_test_suite_runner() so that we get fresh counts each time and don't need to track this information in different ways.
ie:
void run_test(suite, tc) {
if (!tc.enabled) {
suite->skipped++;
} suite->executed++;
if tc.setup
res = tc.setup
else
res = success
if res != success
suite->failed++
return
res = tc.testcase()
switch res {
case success:
suite->success++
break
case fail:
suite->fail++
break
case skipped:
suite->skipped++
break;
case unsupported:
suite->unsupported++;
break;
}
if tc.teardown
tc.teardown()}
...
void run_tests_in_suite(suite) {
struct unit_test_case tc;
size_t total; FOR_EACH_SUITE_TESTCASE(total, suite, tc)
run_test(suite, tc);
}
...
FOR_EACH_SUITE_TESTSUITE(total, suite, tsuite) {
run_tests_in_suite(suite);
}
FOR_EACH_SUITE_TESTSUITE(total, suite, tsuite) {
total_failed += tsuite->failed;
total_executed += tsuite->executed;
total_skipped += tsuite->skipped;
...
}etc..
Does it make sense?
Quoted 58 lines
app/test/test.c +40
-11} + }else { + tc = suite->unit_test_cases[total]; +while (tc.testcase) { +if (!tc.enabled) { + skipped++; + total++; + tc = suite->unit_test_cases[total]; +continue ; + }else { + 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 ) + succeeded++; +else if (test_success ==TEST_SKIPPED ) + skipped++; +else if (test_success == -ENOTSUP ) + unsupported++; +else + failed++; + }else if (test_success == -ENOTSUP ) { + unsupported++; + }else { + 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 ) - succeeded++; + status ="succeeded" ;else if (test_success ==TEST_SKIPPED ) - skipped++; + status ="skipped" ;else if (test_success == -ENOTSUP ) - unsupported++; + status ="unsupported" ;else
app/test/test.c unit_test_suite_runner(struct unit_test_suite *suite) · line 294
Quoted 10 lines
app/test/test.c +0
-10- failed++; - }else if (test_success == -ENOTSUP ) { - unsupported++; - }else { - failed++; - } - -/* run the test case teardown */ -if (tc.teardown) - tc.teardown ();
This got dropped and never re-added anywhere afaict.
Quoted 59 lines
app/test/test.c +26
-12- -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" ; + status ="failed" ; -printf (" + TestCase [%2d] : %s %s\n" , total, tc.name, status); +printf (" + TestCase [%2d] : %s %s\n" , total, + tc.name, status); - total++; - tc = suite->unit_test_cases[total]; + total++; + tc = suite->unit_test_cases[total]; + } }/* Run test suite teardown */ if (suite->teardown) suite->teardown (); +if (suite->parent_testsuite) + goto parent_suite_summary; + goto suite_summary; suite_summary:@@ -332,4 +362,21 @@ unit_test_suite_runner(struct unit_test_suite *suite)if (total == skipped)return TEST_SKIPPED ;return TEST_SUCCESS ; + +parent_suite_summary: +printf (" + ------------------------------------------------------- +\n" ); +printf (" + Parent Test Suite Summary : %s\n" , suite->suite_name); +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" ); + + last_test_result = failed; + +if (sub_ts_failed) +return TEST_FAILED ; +if (sub_ts_total == sub_ts_skipped) +return TEST_SKIPPED ; +return TEST_SUCCESS ; }app/test/test.h +0
-0
app/test/test.h struct unit_test_suite { · line 145
Quoted 9 lines
app/test/test.h +5
-1@@ -138,7 +138,11 @@ struct unit_test_suite {const char *suite_name;int (*setup)(void );void (*teardown)(void ); -struct unit_test_case unit_test_cases[]; +bool parent_testsuite; +union { +struct unit_test_case *unit_test_cases; +struct unit_test_suite *unit_test_suites; + };
I don't see the advantage to this. Why not just have the structs as flat members, and use the NULL of unit_test_suites as your boolean. It saves on refactor of all the test suites, since those members should be 0 initialized anyway. In fact, you are relying on that behavior (since you don't explicitly set parent_testsuite to 'false') so might as well make your life easier by not having to touch all the test suite files.
ie: instead of
if (suite->parent_testsuite)
FOR_EACH_SUITE_TESTSUITE
else
FOR_EACH_SUITE_TESTCASE
you could just do:
struct unit_test_case tc;
struct unit_test_suite ts;
size_t total;
if (suite->unit_test_suite && suite->unit_test_case)
/* is this prohibited? */
FOR_EACH_SUITE_TESTCASE(total, suite, tc);
...
FOR_EACH_SUITE_TESTSUITE(total, suite, ts)
...This also makes reading the code a bit nicer.
Quoted 826 lines
app/test/test.h +0
-0};int unit_test_suite_runner (struct unit_test_suite *suite);app/test/test_bitratestats.c +2
-2@@ -189,7 +189,7 @@ unit_test_suite bitratestats_testsuite = { .suite_name = "BitRate Stats Unit Test Suite", .setup = test_bit_ring_setup, .teardown = test_bit_ring_free, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { /* TEST CASE 1: Test to create bit rate data */ TEST_CASE(test_stats_bitrate_create),@@ -231,7 +231,7 @@ unit_test_suite bitratestats_testsuite = {/* TEST CASE 9: Test to do the cleanup w.r.t create */ TEST_CASE (test_stats_bitrate_free),TEST_CASES_END () - } + }) }; static intapp/test/test_compressdev.c +2
-2@@ -4183,7 +4183,7 @@ static struct unit_test_suite compressdev_testsuite = { .suite_name = "compressdev unit test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, test_compressdev_invalid_configuration), TEST_CASE_ST(generic_ut_setup, generic_ut_teardown,@@ -4261,7 +4261,7 @@ static struct unit_test_suite compressdev_testsuite = { test_compressdev_deflate_im_buffers_SGL_over_2ops_second),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_cryptodev.c +12
-12@@ -13247,7 +13247,7 @@ 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 = { + .unit_test_cases = ((struct unit_test_case []) { /* Multi Core */ TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op), TEST_CASE_ST(NULL, NULL, test_scheduler_mode_multicore_op),@@ -13281,7 +13281,7 @@ static struct unit_test_suite cryptodev_scheduler_testsuite = {TEST_CASE_ST (NULL ,NULL , test_scheduler_detach_slave_op),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };#endif /* RTE_CRYPTO_SCHEDULER */ @@ -13290,7 +13290,7 @@ static struct unit_test_suite cryptodev_testsuite = { .suite_name = "Crypto Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_device_configure_invalid_dev_id), TEST_CASE_ST(ut_setup, ut_teardown,@@ -13921,25 +13921,25 @@ static struct unit_test_suite cryptodev_testsuite = { 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_virtio_testsuite = { .suite_name ="Crypto VIRTIO Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .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_testsuite = { .suite_name = "Crypto CAAM JR Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_device_configure_invalid_dev_id), TEST_CASE_ST(ut_setup, ut_teardown,@@ -13952,14 +13952,14 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite = { 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_testsuite = { .suite_name ="Crypto Device Marvell Component Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session_random_usage),@@ -13980,14 +13980,14 @@ static struct unit_test_suite cryptodev_mrvl_testsuite = { auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite cryptodev_ccp_testsuite = { .suite_name ="Crypto Device CCP Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session_random_usage),@@ -14008,7 +14008,7 @@ static struct unit_test_suite cryptodev_ccp_testsuite = { auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_cryptodev_asym.c +6
-6@@ -2288,7 +2288,7 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = { .suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { 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),@@ -2300,24 +2300,24 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp), TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite cryptodev_qat_asym_testsuite = { .suite_name ="Crypto Device QAT ASYM Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_one_by_one),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite cryptodev_octeontx_asym_testsuite = { .suite_name ="Crypto Device OCTEONTX ASYM Unit Test Suite" , .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {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),@@ -2326,7 +2326,7 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite = { test_ecdsa_sign_verify_all_curve),TEST_CASE_ST (ut_setup ,ut_teardown ,test_ecpm_all_curve ),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_ethdev_link.c +2
-2@@ -148,13 +148,13 @@ static struct unit_test_suite link_status_testsuite = { .suite_name = "link status formatting", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_link_status_up_default),TEST_CASE (test_link_status_down_default),TEST_CASE (test_link_speed_all_values),TEST_CASE (test_link_status_invalid),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_event_crypto_adapter.c +2
-2@@ -959,7 +959,7 @@ static struct unit_test_suite functional_testsuite = { .suite_name = "Event crypto adapter test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, test_crypto_adapter_free, test_crypto_adapter_create),@@ -989,7 +989,7 @@ static struct unit_test_suite functional_testsuite = { test_sessionless_with_op_new_mode),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_event_eth_rx_adapter.c +4
-4@@ -754,7 +754,7 @@ static struct unit_test_suite event_eth_rx_tests = { .suite_name = "rx event eth adapter test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, adapter_create_free), TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_add_del),@@ -763,18 +763,18 @@ static struct unit_test_suite event_eth_rx_tests = { TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop), TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };static struct unit_test_suite event_eth_rx_intr_tests = { .suite_name ="rx event eth adapter test suite" , .setup = testsuite_setup_rx_intr, .teardown = testsuite_teardown_rx_intr, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (adapter_create, adapter_free, adapter_intr_queue_add_del),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_event_eth_tx_adapter.c +2
-2@@ -680,7 +680,7 @@ static struct unit_test_suite event_eth_tx_tests = { .setup = testsuite_setup, .teardown = testsuite_teardown, .suite_name = "tx event eth adapter test suite", - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, tx_adapter_create_free), TEST_CASE_ST(tx_adapter_create, tx_adapter_free, tx_adapter_queue_add_del),@@ -690,7 +690,7 @@ static struct unit_test_suite event_eth_tx_tests = { tx_adapter_service),TEST_CASE_ST (NULL ,NULL ,tx_adapter_dynamic_device ),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_event_timer_adapter.c +2
-2@@ -1779,7 +1779,7 @@ static struct unit_test_suite event_timer_adptr_functional_testsuite = { .suite_name = "event timer functional test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(timdev_setup_usec, timdev_teardown, test_timer_state), TEST_CASE_ST(timdev_setup_usec, timdev_teardown,@@ -1832,7 +1832,7 @@ static struct unit_test_suite event_timer_adptr_functional_testsuite = { adapter_tick_resolution),TEST_CASE (adapter_create_max ),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_eventdev.c +2
-2@@ -934,7 +934,7 @@ static struct unit_test_suite eventdev_common_testsuite = { .suite_name = "eventdev common code unit test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(NULL, NULL, test_eventdev_count), TEST_CASE_ST(NULL, NULL,@@ -984,7 +984,7 @@ static struct unit_test_suite eventdev_common_testsuite = { TEST_CASE_ST(eventdev_setup_device, NULL, test_eventdev_close),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_fbarray.c +2
-2@@ -714,7 +714,7 @@ static struct unit_test_suite fbarray_test_suite = { .suite_name = "fbarray autotest", .setup = autotest_setup, .teardown = autotest_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_invalid), TEST_CASE(test_basic), TEST_CASE_ST(first_msk_test_setup, reset_array, test_find),@@ -724,7 +724,7 @@ static struct unit_test_suite fbarray_test_suite = { TEST_CASE_ST(full_msk_test_setup, reset_array, test_find), TEST_CASE_ST(empty_msk_test_setup, reset_array, test_empty),TEST_CASES_END () - } + }) }; static intapp/test/test_fib.c +4
-4@@ -375,24 +375,24 @@ static struct unit_test_suite fib_fast_tests = { .suite_name = "fib autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_create_invalid),TEST_CASE (test_free_null),TEST_CASE (test_add_del_invalid),TEST_CASE (test_get_invalid),TEST_CASE (test_lookup),TEST_CASES_END () - } + }) };static struct unit_test_suite fib_slow_tests = { .suite_name ="fib slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/* app/test/test_fib6.c +4
-4@@ -384,24 +384,24 @@ static struct unit_test_suite fib6_fast_tests = { .suite_name = "fib6 autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_create_invalid),TEST_CASE (test_free_null),TEST_CASE (test_add_del_invalid),TEST_CASE (test_get_invalid),TEST_CASE (test_lookup),TEST_CASES_END () - } + }) };static struct unit_test_suite fib6_slow_tests = { .suite_name ="fib6 slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/* app/test/test_graph.c +2
-2@@ -815,7 +815,7 @@ static struct unit_test_suite graph_testsuite = { .suite_name = "Graph library test suite", .setup = graph_setup, .teardown = graph_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_update_edges), TEST_CASE(test_lookup_functions), TEST_CASE(test_create_graph),@@ -823,7 +823,7 @@ static struct unit_test_suite graph_testsuite = {TEST_CASE (test_graph_walk),TEST_CASE (test_print_stats ), TEST_CASES_END(), /**< NULL terminate unit test array */ - }, + }), }; static intapp/test/test_graph_perf.c +2
-2@@ -1035,7 +1035,7 @@ static struct unit_test_suite graph_perf_testsuite = { .suite_name = "Graph library performance test suite", .setup = graph_perf_setup, .teardown = graph_perf_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(graph_init_hr, graph_fini, graph_hr_4s_1n_1src_1snk), TEST_CASE_ST(graph_init_hr_brst_one, graph_fini,@@ -1051,7 +1051,7 @@ static struct unit_test_suite graph_perf_testsuite = { TEST_CASE_ST(graph_init_parallel_tree, graph_fini, graph_parallel_tree_5s_4n_4src_4snk), TEST_CASES_END(), /**< NULL terminate unit test array */ - }, + }), }; static intapp/test/test_ipfrag.c +2
-2@@ -242,12 +242,12 @@ static struct unit_test_suite ipfrag_testsuite = { .suite_name = "IP Frag Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_ip_frag),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_ipsec.c +2
-2@@ -2498,7 +2498,7 @@ static struct unit_test_suite ipsec_testsuite = { .suite_name = "IPsec NULL Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_ipsec_crypto_inb_burst_null_null_wrapper), TEST_CASE_ST(ut_setup, ut_teardown,@@ -2528,7 +2528,7 @@ static struct unit_test_suite ipsec_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_ipsec_crypto_inb_burst_2sa_4grp_null_null_wrapper),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_ipsec_sad.c +2
-2@@ -864,7 +864,7 @@ static struct unit_test_suite ipsec_sad_tests = { .suite_name = "ipsec sad autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_invalid), TEST_CASE(test_find_existing), TEST_CASE(test_multiple_create),@@ -875,7 +875,7 @@ static struct unit_test_suite ipsec_sad_tests = {TEST_CASE (test_lookup_adv),TEST_CASE (test_lookup_order ),TEST_CASES_END () - } + }) }; static intapp/test/test_latencystats.c +2
-2@@ -171,7 +171,7 @@ unit_test_suite latencystats_testsuite = { .suite_name = "Latency Stats Unit Test Suite", .setup = test_latency_ring_setup, .teardown = test_latency_ring_free, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { /* Test Case 1: To check latency init with * metrics init@@ -198,7 +198,7 @@ unit_test_suite latencystats_testsuite = { TEST_CASE_ST(NULL, NULL, test_latency_uninit),TEST_CASES_END () - } + }) };static int test_latencystats (void )app/test/test_link_bonding.c +2
-2@@ -5094,7 +5094,7 @@ static struct unit_test_suite link_bonding_test_suite = { .suite_name = "Link Bonding Unit Test Suite", .setup = test_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_bonded_device), TEST_CASE(test_create_bonded_device_with_invalid_params), TEST_CASE(test_add_slave_to_bonded_device),@@ -5162,7 +5162,7 @@ static struct unit_test_suite link_bonding_test_suite = {TEST_CASE (test_close_bonded_device),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) };app/test/test_link_bonding_mode4.c +2
-2@@ -1653,7 +1653,7 @@ static struct unit_test_suite link_bonding_mode4_test_suite = { .suite_name = "Link Bonding mode 4 Unit Test Suite", .setup = test_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_NAMED("test_mode4_agg_mode_selection", test_mode4_agg_mode_selection_wrapper), TEST_CASE_NAMED("test_mode4_lacp", test_mode4_lacp_wrapper),@@ -1667,7 +1667,7 @@ static struct unit_test_suite link_bonding_mode4_test_suite = { test_mode4_ext_lacp_wrapper),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_link_bonding_rssconf.c +2
-2@@ -645,13 +645,13 @@ test_rss_lazy_wrapper(void)static struct unit_test_suite link_bonding_rssconf_test_suite = { .suite_name ="RSS Dynamic Configuration for Bonding Unit Test Suite" , .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_NAMED ("test_setup" , test_setup_wrapper),TEST_CASE_NAMED ("test_rss" , test_rss_wrapper),TEST_CASE_NAMED ("test_rss_lazy" , test_rss_lazy_wrapper),TEST_CASES_END () - } + }) }; static intapp/test/test_metrics.c +2
-2@@ -275,7 +275,7 @@ static struct unit_test_suite metrics_testsuite = { .suite_name = "Metrics Unit Test Suite", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { /* Test Case 1: Test to check all metric APIs without * metrics init */@@ -317,7 +317,7 @@ static struct unit_test_suite metrics_testsuite = {TEST_CASE (test_metrics_deinitialize),TEST_CASES_END () - } + }) }; static intapp/test/test_pmd_ring.c +2
-2@@ -576,7 +576,7 @@ unit_test_suite test_pmd_ring_suite = { .setup = test_pmd_ringcreate_setup, .teardown = test_cleanup_resources, .suite_name = "Test Pmd Ring Unit Test Suite", - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_ethdev_configure_ports), TEST_CASE(test_send_basic_packets), TEST_CASE(test_get_stats_for_port),@@ -584,7 +584,7 @@ unit_test_suite test_pmd_ring_suite = {TEST_CASE (test_pmd_ring_pair_create_attach),TEST_CASE (test_command_line_ring_port ),TEST_CASES_END () - } + }) }; static intapp/test/test_reorder.c +2
-2@@ -373,7 +373,7 @@ static struct unit_test_suite reorder_test_suite = { .setup = test_setup, .teardown = test_teardown, .suite_name = "Reorder Unit Test Suite", - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_reorder_create), TEST_CASE(test_reorder_init), TEST_CASE(test_reorder_find_existing),@@ -381,7 +381,7 @@ static struct unit_test_suite reorder_test_suite = {TEST_CASE (test_reorder_insert),TEST_CASE (test_reorder_drain ),TEST_CASES_END () - } + }) }; static intapp/test/test_rib.c +4
-4@@ -327,7 +327,7 @@ static struct unit_test_suite rib_tests = { .suite_name = "rib autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_invalid), TEST_CASE(test_free_null), TEST_CASE(test_insert_invalid),@@ -335,17 +335,17 @@ static struct unit_test_suite rib_tests = {TEST_CASE (test_basic),TEST_CASE (test_tree_traversal ),TEST_CASES_END () - } + }) };static struct unit_test_suite rib_slow_tests = { .suite_name ="rib slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/* app/test/test_rib6.c +4
-4@@ -332,7 +332,7 @@ static struct unit_test_suite rib6_tests = { .suite_name = "rib6 autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_create_invalid), TEST_CASE(test_free_null), TEST_CASE(test_insert_invalid),@@ -340,17 +340,17 @@ static struct unit_test_suite rib6_tests = {TEST_CASE (test_basic),TEST_CASE (test_tree_traversal ),TEST_CASES_END () - } + }) };static struct unit_test_suite rib6_slow_tests = { .suite_name ="rib6 slow autotest" , .setup =NULL , .teardown =NULL , - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) {TEST_CASE (test_multiple_create),TEST_CASES_END () - } + }) };/* app/test/test_security.c +2
-2@@ -2484,7 +2484,7 @@ static struct unit_test_suite security_testsuite = { .suite_name = "generic security", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_session_create_inv_context), TEST_CASE_ST(ut_setup, ut_teardown,@@ -2627,7 +2627,7 @@ static struct unit_test_suite security_testsuite = { test_capability_get_docsis_match),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_service_cores.c +2
-2@@ -996,7 +996,7 @@ static struct unit_test_suite service_tests = { .suite_name = "service core test suite", .setup = testsuite_setup, .teardown = testsuite_teardown, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(dummy_register, NULL, unregister_all), TEST_CASE_ST(dummy_register, NULL, service_name), TEST_CASE_ST(dummy_register, NULL, service_get_by_name),@@ -1015,7 +1015,7 @@ static struct unit_test_suite service_tests = { TEST_CASE_ST(dummy_register, NULL, service_may_be_active), TEST_CASE_ST(dummy_register, NULL, service_active_two_cores),TEST_CASES_END ()/**< NULL terminate unit test array */ - } + }) }; static intapp/test/test_trace.c +2
-2@@ -176,7 +176,7 @@ static struct unit_test_suite trace_tests = { .suite_name = "trace autotest", .setup = NULL, .teardown = NULL, - .unit_test_cases = { + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE(test_trace_mode), TEST_CASE(test_generic_trace_points), TEST_CASE(test_fp_trace_points),@@ -185,7 +185,7 @@ static struct unit_test_suite trace_tests = {TEST_CASE (test_trace_point_regex),TEST_CASE (test_trace_points_lookup ),TEST_CASES_END () - } + }) }; static int
PATCH 3/6 test/crypto: refactor to use sub-testsuites
In reply to Ciara PowerThe 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.
--- app/test/test_cryptodev.c | 1663 +++++++++++++++++++++++++++++-------- 1 file changed, 1306 insertions(+), 357 deletions(-)
app/test/test_cryptodev.c +1306 -357
@@ -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,65 @@ 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 = ((struct unit_test_case []) { -/* 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 cryptodev_testsuite = { - .suite_name ="Crypto Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, +static const struct unit_test_suite end_testsuite = { + .suite_name =NULL , + .setup =NULL , + .teardown =NULL , + .parent_testsuite =NULL , + .unit_test_cases =NULL +}; + +static const struct unit_test_suite cryptodev_testsuite = { + .suite_name ="Crypto General Unit Test Suite" , + .parent_testsuite = false, .unit_test_cases = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_device_configure_invalid_dev_id),
@@ -13297,25 +13376,73 @@ 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" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) { +/** 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, - test_multi_session), + 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" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) { +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 const struct unit_test_suite cryptodev_null_testsuite = { + .suite_name ="NULL Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {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 const struct unit_test_suite cryptodev_aes_ccm_auth_testsuite = { + .suite_name = "AES CCM Authenticated Test Suite", + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) { + /** 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 +13489,14 @@ 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 const struct unit_test_suite cryptodev_aes_gcm_auth_testsuite = { + .suite_name ="AES GCM Authenticated Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {/** AES GCM Authenticated Encryption */ TEST_CASE_ST (ut_setup, ut_teardown, test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
@@ -13499,7 +13633,14 @@ 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 const struct unit_test_suite cryptodev_aes_gmac_auth_testsuite = { + .suite_name = "AES GMAC Authentication Test Suite", + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GMAC_authentication_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13525,11 +13666,26 @@ 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 const struct unit_test_suite cryptodev_chacha20_poly1305_testsuite = { + .suite_name ="Chacha20-Poly1305 Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {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 const struct unit_test_suite cryptodev_snow3g_testsuite = { + .suite_name ="SNOW 3G Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {/** SNOW 3G encrypt only (UEA2) */ TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_1),
@@ -13610,6 +13766,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 +13780,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 +13792,14 @@ 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 const struct unit_test_suite cryptodev_zuc_testsuite = { + .suite_name ="ZUC Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {/** ZUC encrypt only (EEA3) */ TEST_CASE_ST (ut_setup, ut_teardown, test_zuc_encryption_test_case_1),
@@ -13692,8 +13857,14 @@ 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 const struct unit_test_suite cryptodev_hmac_md5_auth_testsuite = { + .suite_name = "HMAC_MD5 Authentication Test Suite", + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_MD5_HMAC_generate_case_1), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13702,7 +13873,14 @@ 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 const struct unit_test_suite cryptodev_kasumi_testsuite = { + .suite_name ="Kasumi Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {/** KASUMI hash only (UIA1) */ TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_hash_generate_test_case_1),
@@ -13787,17 +13965,26 @@ 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 const struct unit_test_suite cryptodev_esn_testsuite = { + .suite_name ="ESN Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {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 const struct unit_test_suite cryptodev_negative_aes_gcm_testsuite = { + .suite_name = "Negative AES GCM Test Suite", + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_auth_encryption_fail_iv_corrupt), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13822,16 +14009,28 @@ 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 const struct unit_test_suite cryptodev_negative_aes_gmac_testsuite = { + .suite_name ="Negative AES GMAC Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {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 const struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite = { + .suite_name ="Mixed CIPHER + HASH algorithms Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) {/** 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 +14043,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 +14110,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 = ((struct unit_test_case []) {TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all),
@@ -13935,15 +14123,13 @@ 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" , + .parent_testsuite = false, .unit_test_cases = ((struct unit_test_case []) {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 +14141,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 = ((struct unit_test_case []) { -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 = ((struct unit_test_case []) { -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 +14170,33 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_QAT_SYM_PMD ));
@@ -14021,13 +14204,31 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_VIRTIO_PMD ));
@@ -14035,13 +14236,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ));
@@ -14050,14 +14284,47 @@ 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, + .parent_testsuite = true + }; gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ));
@@ -14067,9 +14334,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 +14350,33 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD ));
@@ -14085,12 +14385,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ));
@@ -14099,14 +14433,47 @@ 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, + .parent_testsuite = true + }; gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ));
@@ -14116,9 +14483,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 +14499,33 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_NULL_PMD ));
@@ -14134,12 +14534,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD ));
@@ -14148,12 +14582,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_KASUMI_PMD ));
@@ -14162,12 +14630,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_ZUC_PMD ));
@@ -14176,12 +14678,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_ARMV8_PMD ));
@@ -14190,12 +14726,47 @@ 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 ; +const 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_MVSAM_PMD ));
@@ -14204,7 +14775,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 +14790,89 @@ test_cryptodev_mrvl(void)static int test_cryptodev_scheduler (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +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 () + }) + }, + { + .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 () + }) + }, + { + .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 () + }) + }, + { + .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 () + }) + } + }; +struct unit_test_suite static_suites[] = { + { + .suite_name ="Crypto Device Scheduler Config Unit Test Suite" , + .parent_testsuite = false, + .unit_test_cases = ((struct unit_test_case []) { +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 */ + }) + }, + end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Scheduler Unit Test Suite" , + .setup = scheduler_testsuite_setup, + .teardown = testsuite_teardown, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ));
@@ -14224,8 +14885,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 +14905,33 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_DPAA2_SEC_PMD ));
@@ -14243,12 +14940,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_DPAA_SEC_PMD ));
@@ -14257,12 +14988,33 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_CCP_PMD ));
@@ -14271,36 +15023,127 @@ 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, + .parent_testsuite = true + }; + 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, + .parent_testsuite = true + }; + 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_CAAM_JR_PMD ));
@@ -14309,12 +15152,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_NITROX_PMD ));
@@ -14323,12 +15200,46 @@ 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, + .parent_testsuite = true + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_BCMFS_PMD ));
@@ -14337,13 +15248,46 @@ 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, + .parent_testsuite = true + }; gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_QAT_SYM_PMD ));
@@ -14353,8 +15297,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;
Signature · 1 line
2.25.1
PATCH 4/6 test/crypto: move testsuite params to header file
In reply to Ciara PowerThe 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.
--- 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(-)
app/test/test_cryptodev.c +3 -15
@@ -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;
app/test/test_cryptodev.h +20 -0
@@ -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_ */
app/test/test_cryptodev_asym.c +50 -43
256 lines not on this page · raw message
app/test/test_ipsec.c +16 -16
@@ -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 = ((struct unit_test_case []) { -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 */ })
Signature · 1 line
2.25.1
PATCH 5/6 test/crypto: dynamically build blockcipher suite
In reply to Ciara PowerIn 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.
--- 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(-)
app/test/test.c +9 -3
@@ -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 )
app/test/test.h +10 -6
@@ -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)
app/test/test_cryptodev.c +304 -207
947 lines not on this page · raw message
app/test/test_cryptodev_blockcipher.c +70 -51
152 lines not on this page · raw message
app/test/test_cryptodev_blockcipher.h +5 -7
@@ -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_ */
Signature · 1 line
2.25.1
PATCH 6/6 doc: add unit test suite change to release notes
In reply to Ciara PowerThe unit test suite framework now supports having nested sub-testsuites, or a list of testcases as before.
This new unit test feature is added to the release notes.
--- doc/guides/rel_notes/release_21_05.rst | 5 +++++ 1 file changed, 5 insertions(+)
doc/guides/rel_notes/release_21_05.rst +5 -0
@@ -70,6 +70,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 -------------
Signature · 1 line
2.25.1
Hey Aaron,
based on the work you've been doing on the unit test documentation we would appreciate if you could take a look over this patchset and get your thoughts. The primary drive here is to make it easier to get a clear picture of what is being executed in the cryptodev testsuite, as at the moment there are test suites masquerading as unit tests and the output doesn't reflect the actual number of unit tests being executed.
Thanks
Declan
Quoted 88 lines · Ciara Power
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 thecryptodev_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/[email protected]/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: dynamically build blockcipher suite
doc: add unit test suite change to release notesapp/test/test.c | 168 +- app/test/test.h | 22 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 2020 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 105 +- app/test/test_cryptodev_blockcipher.c | 121 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 36 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- doc/guides/rel_notes/release_21_05.rst | 5 + 36 files changed, 1898 insertions(+), 739 deletions(-)
Quoted 8 lines · Declan
Hey Aaron,
based on the work you've been doing on the unit test documentation we would appreciate if you could take a look over this patchset and get your thoughts. The primary drive here is to make it easier to get a clear picture of what is being executed in the cryptodev testsuite, as at the moment there are test suites masquerading as unit tests and the output doesn't reflect the actual number of unit tests being executed.
I sent some comments - thanks :)
Quoted 89 lines
Thanks
DeclanQuoted 85 lines · Ciara Power
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 thecryptodev_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 thecryptodev_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/[email protected]/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: dynamically build blockcipher suite
doc: add unit test suite change to release notesapp/test/test.c | 168 +- app/test/test.h | 22 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 2020 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 105 +- app/test/test_cryptodev_blockcipher.c | 121 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 36 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- doc/guides/rel_notes/release_21_05.rst | 5 + 36 files changed, 1898 insertions(+), 739 deletions(-)
Hi Aaron,
Quoted 11 lines
-----Original Message-----
From: Aaron Conole <[email protected]>
Sent: Wednesday 31 March 2021 15:43
To: Doherty, Declan <[email protected]>
Cc: Power, Ciara <[email protected]>; [email protected]
Subject: Re: [PATCH 0/6] test: refactor crypto unit test frameworkQuoted 2 lines · Declan
Hey Aaron,
Quoted 9 lines
Quoted 6 lines
based on the work you've been doing on the unit test documentation we would appreciate if you could take a look over this patchset and get your thoughts. The primary drive here is to make it easier to get a clear picture of what is being executed in the cryptodev testsuite, as at the moment there are test suites masquerading as unit tests and the output doesn't reflect the actual number of unit tests being executed.
I sent some comments - thanks :)
Thanks for the review!
I have sent a v2 including your suggested changes incorporated.
https://patchwork.dpdk.org/project/dpdk/list/?series=16085
Quoted 91 lines
Quoted 42 lines
Thanks
DeclanQuoted 38 lines · Ciara Power
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 thecryptodev_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 thecryptodev_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
Quoted 48 lines
Quoted 48 lines
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: dynamically build blockcipher suite
doc: add unit test suite change to release notesapp/test/test.c | 168 +- app/test/test.h | 22 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 2020 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 105 +- app/test/test_cryptodev_blockcipher.c | 121 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 36 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- doc/guides/rel_notes/release_21_05.rst | 5 + 36 files changed, 1898 insertions(+), 739 deletions(-)
Quoted 94 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ciara Power
Sent: Tuesday, March 16, 2021 10:33 PM
To: [email protected]
Cc: [email protected]; Ciara Power <[email protected]>
Subject: [dpdk-dev] [PATCH 0/6] test: refactor crypto unit test frameworkThe 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 thecryptodev_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-
[email protected]/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: dynamically build blockcipher suite
doc: add unit test suite change to release notesapp/test/test.c | 168 +- app/test/test.h | 22 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 2020 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 105 +- app/test/test_cryptodev_blockcipher.c | 121 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 36 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- doc/guides/rel_notes/release_21_05.rst | 5 + 36 files changed, 1898 insertions(+), 739 deletions(-)
Quoted 2 lines
--
2.25.1
Tested against armv8crypto PMD and the result looks good.
Quoted 106 lines
-----Original Message-----
From: Ruifeng Wang <[email protected]>
Sent: Thursday 1 April 2021 04:14
To: Power, Ciara <[email protected]>; [email protected]
Cc: Doherty, Declan <[email protected]>; nd <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 0/6] test: refactor crypto unit test frameworkQuoted 18 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ciara Power
Sent: Tuesday, March 16, 2021 10:33 PM
To: [email protected]
Cc: [email protected]; Ciara Power <[email protected]>
Subject: [dpdk-dev] [PATCH 0/6] test: refactor crypto unit test frameworkThe 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.
Quoted 7 lines
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 therunner.
Quoted 6 lines
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.
Quoted 10 lines
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 thecryptodev_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.Quoted 6 lines
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-
Quoted 48 lines
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: dynamically build blockcipher suite
doc: add unit test suite change to release notesapp/test/test.c | 168 +- app/test/test.h | 22 +- app/test/test_bitratestats.c | 4 +- app/test/test_compressdev.c | 4 +- app/test/test_cryptodev.c | 2020 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 105 +- app/test/test_cryptodev_blockcipher.c | 121 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ethdev_link.c | 4 +- app/test/test_event_crypto_adapter.c | 4 +- app/test/test_event_eth_rx_adapter.c | 8 +- app/test/test_event_eth_tx_adapter.c | 4 +- app/test/test_event_timer_adapter.c | 4 +- app/test/test_eventdev.c | 4 +- app/test/test_fbarray.c | 4 +- app/test/test_fib.c | 8 +- app/test/test_fib6.c | 8 +- app/test/test_graph.c | 4 +- app/test/test_graph_perf.c | 4 +- app/test/test_ipfrag.c | 4 +- app/test/test_ipsec.c | 36 +- app/test/test_ipsec_sad.c | 4 +- app/test/test_latencystats.c | 4 +- app/test/test_link_bonding.c | 4 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_metrics.c | 4 +- app/test/test_pmd_ring.c | 4 +- app/test/test_reorder.c | 4 +- app/test/test_rib.c | 8 +- app/test/test_rib6.c | 8 +- app/test/test_security.c | 4 +- app/test/test_service_cores.c | 4 +- app/test/test_trace.c | 4 +- doc/guides/rel_notes/release_21_05.rst | 5 + 36 files changed, 1898 insertions(+), 739 deletions(-)
Quoted 5 lines
Quoted 2 lines
--
2.25.1Tested against armv8crypto PMD and the result looks good.
Tested-by Ruifeng Wang <[email protected]>
Thanks for testing this Ruifeng.
I have just sent a v2 of the patchset but didn't add the "Tested-by" tag, as it has quite a number of changes.
I don't think the changes should have affected armv8crypto PMD, but if you could test with the new version that would be really appreciated.
https://patchwork.dpdk.org/project/dpdk/list/?series=16085
Thanks!
Ciara