test: refactor crypto unit test framework
v2 cover test: refactor crypto unit test framework
v2:
- Added macro in place of testcase/testsuite loops.
- Added more detail in the summary output.
- Moved testcase counts to the testsuite structure.
- Flattened testsuite structure to remove union.
- Added patch for fix of blockcipher test return value.
- Squashed release note into last patch.
The current crypto unit test framework is not granular enough to accurately track unit test results. This is caused by one testcase in a suite actually running multiple testcases, but only returning one result.
The approach taken in this patchset allows a test suite have either a list of sub-testsuites, or a list of testcases as previously used. The unit test suite runner can then recursively iterate and run the sub-testsuites, until it reaches a suite with testcases, and it then runs each testcase as it had done previously.
By allowing this further breakdown into sub-testsuites,
a refactor of the crypto unit tests solves the issue of inaccurate reporting, as sub-testsuites can be used in place of the testcases that had multiple testcases hidden on a sub level.
The blockcipher tests previously had these hidden testcases, but are now sub-testsuites that are dynamically created and added to a parent test suite, allowing for each testcase status to be reported directly to the runner.
The cryptodev test suite is broken down into smaller suites that are used as sub-testsuites, which allows for more flexibility choosing which sub-testsuites should run for the current device autotest. The introduction of sub-testsuites also allows for more precise setup/teardown functions, rather than general ones loaded with conditions as was seen with the initial setup function used for all crypto testsuites.
For example, when running the cryptodev_aesni_mb_autotest, the AESNI MB parent test suite has its own setup function to initialise the AESNI MB device.
Various sub-testsuites are added to the parent test suite, such as some of the static suites that were once in the cryptodev_testsuite, and blockcipher suites.
The unit test runner can then run the AESNI MB parent test suite, which in turn will run the sub-testsuites.
Documentation will be added in a later version of the patchset, adding to the test document that isn't yet merged. [1]
---
[1] https://patchwork.dpdk.org/project/dpdk/patch/[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: fix return value on test skipped test/crypto: dynamically build blockcipher suite
app/test/test.c | 226 ++- app/test/test.h | 23 +- app/test/test_cryptodev.c | 1964 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 93 +- app/test/test_cryptodev_blockcipher.c | 127 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ipsec.c | 32 +- doc/guides/rel_notes/release_21_05.rst | 5 + 9 files changed, 1831 insertions(+), 671 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 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.
A macro has been introduced for readability, instead of using open coded loops.
Rather than keep local variable status counts for testcases, these are added to the test suite structure.
The summary output now prints the suite name, this will be useful later when multiple nested sub-testsuites are being run.
---
v2:
- Added macro to loop testcases in suite.
- Testcase counts added to the test suite structure.
--- app/test/test.c | 101 +++++++++++++++++++++++++++++------------------- app/test/test.h | 6 +++ 2 files changed, 67 insertions(+), 40 deletions(-)
app/test/test.c +61 -40
@@ -36,6 +36,11 @@ extern cmdline_parse_ctx_t main_ctx[];#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 +#define FOR_EACH_SUITE_TESTCASE (iter, suite, case) \ + for (iter = 0, case = suite->unit_test_cases[0]; \ + suite->unit_test_cases[iter].testcase; \ + iter++, case = suite->unit_test_cases[iter]) +const char *prgname;/* to be set to argv[0] */ static const char *recursive_call;/* used in linux for MP and other tests */
@@ -207,14 +212,39 @@ main(int argc, char **argv)return ret; } +static void +unit_test_suite_count_tcs_on_setup_fail (struct unit_test_suite *suite, +int test_success) +{ +struct unit_test_case tc; + + FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { +if (!tc.enabled || test_success ==TEST_SKIPPED ) + suite->skipped++; +else + suite->failed++; + } +} + +static void +unit_test_suite_reset_counts (struct unit_test_suite *suite) +{ + suite->total =0 ; + suite->executed =0 ; + suite->succeeded =0 ; + suite->skipped =0 ; + suite->failed =0 ; + suite->unsupported =0 ; +}int unit_test_suite_runner (struct unit_test_suite *suite) {int test_success; -unsigned int total =0 , executed =0 , skipped =0 ; -unsigned int succeeded =0 , failed =0 , unsupported =0 ;const char *status; +struct unit_test_case tc; + +unit_test_suite_reset_counts (suite);if (suite->suite_name) {printf (" + ------------------------------------------------------- +\n" );
@@ -228,55 +258,48 @@ unit_test_suite_runner(struct unit_test_suite *suite)* setup did not pass, so count all enabled tests and * mark them as failed/skipped */ -while (suite->unit_test_cases[total].testcase) { -if (!suite->unit_test_cases[total].enabled || - test_success ==TEST_SKIPPED ) - skipped++; -else - failed++; - total++; - } +unit_test_suite_count_tcs_on_setup_fail (suite, + test_success); goto suite_summary; } }printf (" + ------------------------------------------------------- +\n" ); -while (suite->unit_test_cases[total].testcase) { -if (!suite->unit_test_cases[total].enabled) { - skipped++; - total++; + FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { +if (!tc.enabled) { + suite->skipped++;continue ; }else { - executed++; + suite->executed++; }/* run test case setup */ -if (suite->unit_test_cases[total].setup) - test_success = suite->unit_test_cases[total].setup (); +if (tc.setup) + test_success = tc.setup ();else test_success =TEST_SUCCESS ;if (test_success ==TEST_SUCCESS ) {/* run the test case */ - test_success = suite->unit_test_cases[total].testcase (); + test_success = tc.testcase ();if (test_success ==TEST_SUCCESS ) - succeeded++; + suite->succeeded++;else if (test_success ==TEST_SKIPPED ) - skipped++; + suite->skipped++;else if (test_success == -ENOTSUP ) - unsupported++; + suite->unsupported++;else - failed++; + suite->failed++; }else if (test_success == -ENOTSUP ) { - unsupported++; + suite->unsupported++; }else { - failed++; + suite->failed++; }/* run the test case teardown */ -if (suite->unit_test_cases[total].teardown) - suite->unit_test_cases[total].teardown (); +if (tc.teardown) + tc.teardown ();if (test_success ==TEST_SUCCESS ) status ="succeeded" ;
@@ -287,10 +310,8 @@ unit_test_suite_runner(struct unit_test_suite *suite)else status ="failed" ; -printf (" + TestCase [%2d] : %s %s\n" , total, - suite->unit_test_cases[total].name, status); - - total++; +printf (" + TestCase [%2d] : %s %s\n" , suite->total, + tc.name, status); }/* Run test suite teardown */
@@ -301,20 +322,20 @@ unit_test_suite_runner(struct unit_test_suite *suite) suite_summary:printf (" + ------------------------------------------------------- +\n" ); -printf (" + Test Suite Summary \n" ); -printf (" + Tests Total : %2d\n" , total); -printf (" + Tests Skipped : %2d\n" , skipped); -printf (" + Tests Executed : %2d\n" , executed); -printf (" + Tests Unsupported: %2d\n" , unsupported); -printf (" + Tests Passed : %2d\n" , succeeded); -printf (" + Tests Failed : %2d\n" , failed); +printf (" + Test Suite Summary : %s\n" , suite->suite_name); +printf (" + Tests Total : %2d\n" , suite->total); +printf (" + Tests Skipped : %2d\n" , suite->skipped); +printf (" + Tests Executed : %2d\n" , suite->executed); +printf (" + Tests Unsupported: %2d\n" , suite->unsupported); +printf (" + Tests Passed : %2d\n" , suite->succeeded); +printf (" + Tests Failed : %2d\n" , suite->failed);printf (" + ------------------------------------------------------- +\n" ); - last_test_result = failed; + last_test_result = suite->failed; -if (failed) +if (suite->failed)return TEST_FAILED ; -if (total == skipped) +if (suite->total == suite->skipped)return TEST_SKIPPED ;return TEST_SUCCESS ; }
app/test/test.h +6 -0
@@ -138,6 +138,12 @@ struct unit_test_suite {const char *suite_name;int (*setup)(void );void (*teardown)(void ); +unsigned int total; +unsigned int executed; +unsigned int succeeded; +unsigned int skipped; +unsigned int failed; +unsigned int unsupported;struct unit_test_case unit_test_cases[]; };
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 1/6] app/test: refactor of unit test suite runner
Quoted 21 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.
A macro has been introduced for readability, instead of using open coded loops.
Rather than keep local variable status counts for testcases, these are added to the test suite structure.
The summary output now prints the suite name, this will be useful later when multiple nested sub-testsuites are being run.
Quoted 7 lines
Signed-off-by Ciara Power <[email protected]>---
v2:
- Added macro to loop testcases in suite.
- Testcase counts added to the test suite structure.
---
PATCH v2 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 a pointer to a list of sub-testsuite pointers, along with the list of testcases as before. Both should not be used at once, if there are sub-testsuite pointers, that takes precedence over testcases.
---
v2:
- Added macro to loop sub-testsuites.
- Added sub-testsuite summary detail.
--- app/test/test.c | 168 ++++++++++++++++++++++++++++++++++-------------- app/test/test.h | 1 + 2 files changed, 122 insertions(+), 47 deletions(-)
app/test/test.c +121 -47
@@ -41,6 +41,11 @@ extern cmdline_parse_ctx_t main_ctx[]; suite->unit_test_cases[iter].testcase; \ iter++, case = suite->unit_test_cases[iter]) +#define FOR_EACH_SUITE_TESTSUITE (iter, suite, sub_ts) \ + for (iter = 0, sub_ts = suite->unit_test_suites[0]; \ + suite->unit_test_suites[iter]->suite_name != NULL; \ + iter++, sub_ts = suite->unit_test_suites[iter]) +const char *prgname;/* to be set to argv[0] */ static const char *recursive_call;/* used in linux for MP and other tests */
@@ -214,21 +219,46 @@ main(int argc, char **argv)static void unit_test_suite_count_tcs_on_setup_fail (struct unit_test_suite *suite, -int test_success) +int test_success,unsigned int *sub_ts_failed, +unsigned int *sub_ts_skipped,unsigned int *sub_ts_total) {struct unit_test_case tc; - - FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { -if (!tc.enabled || test_success ==TEST_SKIPPED ) - suite->skipped++; -else - suite->failed++; +struct unit_test_suite *ts; +int i; + +if (suite->unit_test_suites) { + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) { +unit_test_suite_count_tcs_on_setup_fail ( + ts, test_success, sub_ts_failed, + sub_ts_skipped, sub_ts_total); + suite->total += ts->total; + suite->failed += ts->failed; + suite->skipped += ts->skipped; +if (ts->failed) + (*sub_ts_failed)++; +else + (*sub_ts_skipped)++; + (*sub_ts_total)++; + } + }else { + FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { +if (!tc.enabled || test_success ==TEST_SKIPPED ) + suite->skipped++; +else + suite->failed++; + } } }static void unit_test_suite_reset_counts (struct unit_test_suite *suite) { +struct unit_test_suite *ts; +int i; + +if (suite->unit_test_suites) + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) +unit_test_suite_reset_counts (ts); suite->total =0 ; suite->executed =0 ; suite->succeeded =0 ;
@@ -240,9 +270,12 @@ unit_test_suite_reset_counts(struct unit_test_suite *suite)int unit_test_suite_runner (struct unit_test_suite *suite) { -int test_success; +int test_success, i, ret;const char *status;struct unit_test_case tc; +struct unit_test_suite *ts; +unsigned int sub_ts_succeeded =0 , sub_ts_failed =0 ; +unsigned int sub_ts_skipped =0 , sub_ts_total =0 ;unit_test_suite_reset_counts (suite);
@@ -259,70 +292,111 @@ unit_test_suite_runner(struct unit_test_suite *suite)* mark them as failed/skipped */ unit_test_suite_count_tcs_on_setup_fail (suite, - test_success); + test_success, &sub_ts_failed, + &sub_ts_skipped, &sub_ts_total); goto suite_summary; } }printf (" + ------------------------------------------------------- +\n" ); - FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { -if (!tc.enabled) { - suite->skipped++; -continue ; - }else { - suite->executed++; +if (suite->unit_test_suites) { + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) { + ret =unit_test_suite_runner (ts); +if (ret ==TEST_SUCCESS ) + sub_ts_succeeded++; +else if (ret ==TEST_SKIPPED ) + sub_ts_skipped++; +else + sub_ts_failed++; + sub_ts_total++; } + }else { + FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { +if (!tc.enabled) { + suite->skipped++; +continue ; + }else { + suite->executed++; + } + +/* run test case setup */ +if (tc.setup) + test_success = tc.setup (); +else + test_success =TEST_SUCCESS ; + +if (test_success ==TEST_SUCCESS ) { +/* run the test case */ + test_success = tc.testcase (); +if (test_success ==TEST_SUCCESS ) + suite->succeeded++; +else if (test_success ==TEST_SKIPPED ) + suite->skipped++; +else if (test_success == -ENOTSUP ) + suite->unsupported++; +else + suite->failed++; + }else if (test_success == -ENOTSUP ) { + suite->unsupported++; + }else { + suite->failed++; + } -/* run test case setup */ -if (tc.setup) - test_success = tc.setup (); -else - test_success =TEST_SUCCESS ; +/* run the test case teardown */ +if (tc.teardown) + tc.teardown (); -if (test_success ==TEST_SUCCESS ) { -/* run the test case */ - test_success = tc.testcase ();if (test_success ==TEST_SUCCESS ) - suite->succeeded++; + status ="succeeded" ;else if (test_success ==TEST_SKIPPED ) - suite->skipped++; + status ="skipped" ;else if (test_success == -ENOTSUP ) - suite->unsupported++; + status ="unsupported" ;else - suite->failed++; - }else if (test_success == -ENOTSUP ) { - suite->unsupported++; - }else { - suite->failed++; - } + status ="failed" ; -/* run the test case teardown */ -if (tc.teardown) - tc.teardown (); - -if (test_success ==TEST_SUCCESS ) - status ="succeeded" ; -else if (test_success ==TEST_SKIPPED ) - status ="skipped" ; -else if (test_success == -ENOTSUP ) - status ="unsupported" ; -else - status ="failed" ; - -printf (" + TestCase [%2d] : %s %s\n" , suite->total, - tc.name, status); +printf (" + TestCase [%2d] : %s %s\n" , suite->total, + tc.name, status); + } }/* Run test suite teardown */ if (suite->teardown) suite->teardown (); +if (suite->unit_test_suites) + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) { + suite->total += ts->total; + suite->succeeded += ts->succeeded; + suite->failed += ts->failed; + suite->skipped += ts->skipped; + suite->unsupported += ts->unsupported; + suite->executed += ts->executed; + } + goto suite_summary; suite_summary:printf (" + ------------------------------------------------------- +\n" );printf (" + Test Suite Summary : %s\n" , suite->suite_name); +printf (" + ------------------------------------------------------- +\n" ); + +if (suite->unit_test_suites) { + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) +printf (" + %s : %d/%d passed, %d/%d skipped, " +"%d/%d failed, %d/%d unsupported\n" , + ts->suite_name, ts->succeeded, ts->total, + ts->skipped, ts->total, ts->failed, ts->total, + ts->unsupported, ts->total); +printf (" + ------------------------------------------------------- +\n" ); +printf (" + Sub Testsuites Total : %2d\n" , sub_ts_total); +printf (" + Sub Testsuites Skipped : %2d\n" , sub_ts_skipped); +printf (" + Sub Testsuites Passed : %2d\n" , sub_ts_succeeded); +printf (" + Sub Testsuites Failed : %2d\n" , sub_ts_failed); +printf (" + ------------------------------------------------------- +\n" ); + } +printf (" + Tests Total : %2d\n" , suite->total);printf (" + Tests Skipped : %2d\n" , suite->skipped);printf (" + Tests Executed : %2d\n" , suite->executed);
app/test/test.h +1 -0
@@ -144,6 +144,7 @@ struct unit_test_suite {unsigned int skipped;unsigned int failed;unsigned int unsupported; +struct unit_test_suite **unit_test_suites;struct unit_test_case unit_test_cases[]; };
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format
Quoted 262 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 a pointer to a list of sub-testsuite pointers, along with the list of testcases as before. Both should not be used at once, if there are sub-testsuite pointers, that takes precedence over testcases.
Signed-off-by Ciara Power <[email protected]>---
v2:
- Added macro to loop sub-testsuites.
- Added sub-testsuite summary detail.--- app/test/test.c | 168 ++++++++++++++++++++++++++++++++++-------------- app/test/test.h | 1 + 2 files changed, 122 insertions(+), 47 deletions(-)app/test/test.c +121
-47@@ -41,6 +41,11 @@ extern cmdline_parse_ctx_t main_ctx[]; suite->unit_test_cases[iter].testcase; \ iter++, case = suite->unit_test_cases[iter]) +#define FOR_EACH_SUITE_TESTSUITE (iter, suite, sub_ts) \ + for (iter = 0, sub_ts = suite->unit_test_suites[0]; \ + suite->unit_test_suites[iter]->suite_name != NULL; \ + iter++, sub_ts = suite->unit_test_suites[iter]) +const char *prgname;/* to be set to argv[0] */ static const char *recursive_call;/* used in linux for MP and other tests */ @@ -214,21 +219,46 @@ main(int argc, char **argv)static void unit_test_suite_count_tcs_on_setup_fail (struct unit_test_suite *suite, -int test_success) +int test_success,unsigned int *sub_ts_failed, +unsigned int *sub_ts_skipped,unsigned int *sub_ts_total) {struct unit_test_case tc; - - FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { -if (!tc.enabled || test_success ==TEST_SKIPPED ) - suite->skipped++; -else - suite->failed++; +struct unit_test_suite *ts; +int i; + +if (suite->unit_test_suites) { + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) { +unit_test_suite_count_tcs_on_setup_fail ( + ts, test_success, sub_ts_failed, + sub_ts_skipped, sub_ts_total); + suite->total += ts->total; + suite->failed += ts->failed; + suite->skipped += ts->skipped; +if (ts->failed) + (*sub_ts_failed)++; +else + (*sub_ts_skipped)++; + (*sub_ts_total)++; + } + }else { + FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { +if (!tc.enabled || test_success ==TEST_SKIPPED ) + suite->skipped++; +else + suite->failed++; + } } }static void unit_test_suite_reset_counts (struct unit_test_suite *suite) { +struct unit_test_suite *ts; +int i; + +if (suite->unit_test_suites) + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) +unit_test_suite_reset_counts (ts); suite->total =0 ; suite->executed =0 ; suite->succeeded =0 ;@@ -240,9 +270,12 @@ unit_test_suite_reset_counts(struct unit_test_suite *suite)int unit_test_suite_runner (struct unit_test_suite *suite) { -int test_success; +int test_success, i, ret;const char *status;struct unit_test_case tc; +struct unit_test_suite *ts; +unsigned int sub_ts_succeeded =0 , sub_ts_failed =0 ; +unsigned int sub_ts_skipped =0 , sub_ts_total =0 ;unit_test_suite_reset_counts (suite);@@ -259,70 +292,111 @@ unit_test_suite_runner(struct unit_test_suite *suite)* mark them as failed/skipped */ unit_test_suite_count_tcs_on_setup_fail (suite, - test_success); + test_success, &sub_ts_failed, + &sub_ts_skipped, &sub_ts_total); goto suite_summary; } }printf (" + ------------------------------------------------------- +\n" ); - FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { -if (!tc.enabled) { - suite->skipped++; -continue ; - }else { - suite->executed++; +if (suite->unit_test_suites) { + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) { + ret =unit_test_suite_runner (ts); +if (ret ==TEST_SUCCESS ) + sub_ts_succeeded++; +else if (ret ==TEST_SKIPPED ) + sub_ts_skipped++; +else + sub_ts_failed++; + sub_ts_total++; } + }else { + FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) { +if (!tc.enabled) { + suite->skipped++; +continue ; + }else { + suite->executed++; + } + +/* run test case setup */ +if (tc.setup) + test_success = tc.setup (); +else + test_success =TEST_SUCCESS ; + +if (test_success ==TEST_SUCCESS ) { +/* run the test case */ + test_success = tc.testcase (); +if (test_success ==TEST_SUCCESS ) + suite->succeeded++; +else if (test_success ==TEST_SKIPPED ) + suite->skipped++; +else if (test_success == -ENOTSUP ) + suite->unsupported++; +else + suite->failed++; + }else if (test_success == -ENOTSUP ) { + suite->unsupported++; + }else { + suite->failed++; + } -/* run test case setup */ -if (tc.setup) - test_success = tc.setup (); -else - test_success =TEST_SUCCESS ; +/* run the test case teardown */ +if (tc.teardown) + tc.teardown (); -if (test_success ==TEST_SUCCESS ) { -/* run the test case */ - test_success = tc.testcase ();if (test_success ==TEST_SUCCESS ) - suite->succeeded++; + status ="succeeded" ;else if (test_success ==TEST_SKIPPED ) - suite->skipped++; + status ="skipped" ;else if (test_success == -ENOTSUP ) - suite->unsupported++; + status ="unsupported" ;else - suite->failed++; - }else if (test_success == -ENOTSUP ) { - suite->unsupported++; - }else { - suite->failed++; - } + status ="failed" ; -/* run the test case teardown */ -if (tc.teardown) - tc.teardown (); - -if (test_success ==TEST_SUCCESS ) - status ="succeeded" ; -else if (test_success ==TEST_SKIPPED ) - status ="skipped" ; -else if (test_success == -ENOTSUP ) - status ="unsupported" ; -else - status ="failed" ; - -printf (" + TestCase [%2d] : %s %s\n" , suite->total, - tc.name, status); +printf (" + TestCase [%2d] : %s %s\n" , suite->total, + tc.name, status); + } }/* Run test suite teardown */ if (suite->teardown) suite->teardown (); +if (suite->unit_test_suites) + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) { + suite->total += ts->total; + suite->succeeded += ts->succeeded; + suite->failed += ts->failed; + suite->skipped += ts->skipped; + suite->unsupported += ts->unsupported; + suite->executed += ts->executed; + } + goto suite_summary; suite_summary:printf (" + ------------------------------------------------------- +\n" );printf (" + Test Suite Summary : %s\n" , suite->suite_name); +printf (" + ------------------------------------------------------- +\n" ); + +if (suite->unit_test_suites) { + FOR_EACH_SUITE_TESTSUITE(i, suite, ts) +printf (" + %s : %d/%d passed, %d/%d skipped, " +"%d/%d failed, %d/%d unsupported\n" , + ts->suite_name, ts->succeeded, ts->total, + ts->skipped, ts->total, ts->failed, ts->total, + ts->unsupported, ts->total); +printf (" + ------------------------------------------------------- +\n" ); +printf (" + Sub Testsuites Total : %2d\n" , sub_ts_total); +printf (" + Sub Testsuites Skipped : %2d\n" , sub_ts_skipped); +printf (" + Sub Testsuites Passed : %2d\n" , sub_ts_succeeded); +printf (" + Sub Testsuites Failed : %2d\n" , sub_ts_failed); +printf (" + ------------------------------------------------------- +\n" ); + } +printf (" + Tests Total : %2d\n" , suite->total);printf (" + Tests Skipped : %2d\n" , suite->skipped);printf (" + Tests Executed : %2d\n" , suite->executed);app/test/test.h +0
-0
app/test/test.h struct unit_test_suite { · line 147
Quoted 4 lines
app/test/test.h +1
-0@@ -144,6 +144,7 @@ struct unit_test_suite {unsigned int skipped;unsigned int failed;unsigned int unsupported; +struct unit_test_suite **unit_test_suites;
If it's only ever possible to either have test_suites or test_cases for iterators, maybe it's best to put in an assert for that.
Either way, we probably don't need to
if (suite->unit_test_suites) {
...
} else {
...
}It might be better to just look like:
FOR_EACH_SUITE_TESTSUITE(...) {
...
}
FOR_EACH_SUITE_TESTCASE(...) {
...
}Code looks nicer, and we can also support a mix of suite/case (unless there is a reason not to do that). WDYT? As the code exists, if I were to write a new test suite with some sub-test suites, I might do:
overall_suite {
.unit_test_suite = {
{sub_suite1, ...},
{sub_suite2, ...}
},
.unit_test_cases = {
{test_case_1, ...},
{test_case_2, ...}
}
}And then I would be surprised if they didn't run.
Quoted 2 lines
app/test/test.h +0
-0struct unit_test_case unit_test_cases[]; };
PATCH v2 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.
---
v2:
- Modified sub-testsuites to be added as pointers.
- Made necessary changes resulting from v2 changes in previous patches.
--- app/test/test_cryptodev.c | 1617 +++++++++++++++++++++++++++++-------- 1 file changed, 1261 insertions(+), 356 deletions(-)
app/test/test_cryptodev.c +1261 -356
@@ -112,6 +112,10 @@ struct crypto_unittest_params {#define ALIGN_POW2_ROUNDUP (num, align) \ (((num) + (align) - 1) & ~((align) - 1)) +#define ADD_STATIC_TESTSUITE (index, parent_ts, child_ts, num_child_ts) \ + for (j = 0; j < num_child_ts; index++, j++) \ + parent_ts.unit_test_suites[index] = child_ts[j] +/* * Forward declarations. */
@@ -491,12 +495,11 @@ static struct crypto_testsuite_params testsuite_params = { NULL };static struct crypto_unittest_params unittest_params;static int -testsuite_setup (void ) +testsuite_params_setup (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;struct rte_cryptodev_info info;uint32_t i =0 , nb_devs, dev_id; -int ret;uint16_t qp_id;memset (ts_params,0 ,sizeof (*ts_params));
@@ -542,217 +545,6 @@ testsuite_setup(void)return TEST_FAILED ; } -/* Create an AESNI MB device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ))); -if (nb_devs <1 ) { - ret =rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ),NULL ); - -TEST_ASSERT (ret ==0 , -"Failed to create instance of" -" pmd : %s" , -RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD )); - } - } - -/* Create an AESNI GCM device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ))); -if (nb_devs <1 ) { -TEST_ASSERT_SUCCESS (rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ),NULL ), -"Failed to create instance of" -" pmd : %s" , -RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD )); - } - } - -/* Create a SNOW 3G device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD ))); -if (nb_devs <1 ) { -TEST_ASSERT_SUCCESS (rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD ),NULL ), -"Failed to create instance of" -" pmd : %s" , -RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD )); - } - } - -/* Create a KASUMI device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_KASUMI_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_KASUMI_PMD ))); -if (nb_devs <1 ) { -TEST_ASSERT_SUCCESS (rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_KASUMI_PMD ),NULL ), -"Failed to create instance of" -" pmd : %s" , -RTE_STR (CRYPTODEV_NAME_KASUMI_PMD )); - } - } - -/* Create a ZUC device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_ZUC_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_ZUC_PMD ))); -if (nb_devs <1 ) { -TEST_ASSERT_SUCCESS (rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_ZUC_PMD ),NULL ), -"Failed to create instance of" -" pmd : %s" , -RTE_STR (CRYPTODEV_NAME_ZUC_PMD )); - } - } - -/* Create a NULL device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_NULL_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_NULL_PMD ))); -if (nb_devs <1 ) { - ret =rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_NULL_PMD ),NULL ); - -TEST_ASSERT (ret ==0 , -"Failed to create instance of" -" pmd : %s" , -RTE_STR (CRYPTODEV_NAME_NULL_PMD )); - } - } - -/* Create an OPENSSL device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD ))); -if (nb_devs <1 ) { - ret =rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD ), -NULL ); - -TEST_ASSERT (ret ==0 ,"Failed to create " -"instance of pmd : %s" , -RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD )); - } - } - -/* Create a ARMv8 device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_ARMV8_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_ARMV8_PMD ))); -if (nb_devs <1 ) { - ret =rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_ARMV8_PMD ), -NULL ); - -TEST_ASSERT (ret ==0 ,"Failed to create " -"instance of pmd : %s" , -RTE_STR (CRYPTODEV_NAME_ARMV8_PMD )); - } - } - -/* Create a MVSAM device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_MVSAM_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_MVSAM_PMD ))); -if (nb_devs <1 ) { - ret =rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_MVSAM_PMD ), -NULL ); - -TEST_ASSERT (ret ==0 ,"Failed to create " -"instance of pmd : %s" , -RTE_STR (CRYPTODEV_NAME_MVSAM_PMD )); - } - } - -/* Create an CCP device if required */ -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_CCP_PMD ))) { - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_CCP_PMD ))); -if (nb_devs <1 ) { - ret =rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_CCP_PMD ), -NULL ); - -TEST_ASSERT (ret ==0 ,"Failed to create " -"instance of pmd : %s" , -RTE_STR (CRYPTODEV_NAME_CCP_PMD )); - } - } - -#ifdef RTE_CRYPTO_SCHEDULER -char vdev_args[VDEV_ARGS_SIZE ] = {"" }; -char temp_str[VDEV_ARGS_SIZE ] = {"mode=multi-core," -"ordering=enable,name=cryptodev_test_scheduler,corelist=" }; -uint16_t worker_core_count =0 ; -uint16_t socket_id =0 ; - -if (gbl_driver_id ==rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ))) { - -/* Identify the Worker Cores -* Use 2 worker cores for the device args -*/ -RTE_LCORE_FOREACH_WORKER (i) { -if (worker_core_count >1 ) -break ; -snprintf (vdev_args,sizeof (vdev_args), -"%s%d" , temp_str, i); -strcpy (temp_str, vdev_args); -strlcat (temp_str,";" ,sizeof (temp_str)); - worker_core_count++; - socket_id =rte_lcore_to_socket_id (i); - } -if (worker_core_count !=2 ) { -RTE_LOG (ERR ,USER1 , -"Cryptodev scheduler test require at least " -"two worker cores to run. " -"Please use the correct coremask.\n" ); -return TEST_FAILED ; - } -strcpy (temp_str, vdev_args); -snprintf (vdev_args,sizeof (vdev_args),"%s,socket_id=%d" , - temp_str, socket_id); -RTE_LOG (DEBUG ,USER1 ,"vdev_args: %s\n" , vdev_args); - nb_devs =rte_cryptodev_device_count_by_driver ( -rte_cryptodev_driver_id_get ( -RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ))); -if (nb_devs <1 ) { - ret =rte_vdev_init ( -RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ), - vdev_args); -TEST_ASSERT (ret ==0 , -"Failed to create instance %u of" -" pmd : %s" , - i,RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD )); - } - } -#endif /* RTE_CRYPTO_SCHEDULER */ - nb_devs =rte_cryptodev_count ();if (nb_devs <1 ) {RTE_LOG (WARNING ,USER1 ,"No crypto devices found?\n" );
@@ -838,6 +630,228 @@ testsuite_setup(void)return TEST_SUCCESS ; } +static int +qat_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +aesni_mb_testsuite_setup (void ) +{ +int32_t nb_devs, ret; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ))); +if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ),NULL ); + +TEST_ASSERT (ret ==0 , +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD )); + } +return testsuite_params_setup (); +} + +static int +virtio_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +openssl_testsuite_setup (void ) +{ +int32_t nb_devs, ret; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD ))); +if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD ),NULL ); + +TEST_ASSERT (ret ==0 ,"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD )); + } +return testsuite_params_setup (); +} + +static int +aesni_gcm_testsuite_setup (void ) +{ +int32_t nb_devs; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ))); +if (nb_devs <1 ) { +TEST_ASSERT_SUCCESS (rte_vdev_init ( +RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ),NULL ), +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD )); + } +return testsuite_params_setup (); +} + +static int +null_testsuite_setup (void ) +{ +int32_t nb_devs, ret; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_NULL_PMD ))); +if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_NULL_PMD ),NULL ); + +TEST_ASSERT (ret ==0 , +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_NULL_PMD )); + } +return testsuite_params_setup (); +} + +static int +sw_snow3g_testsuite_setup (void ) +{ +int32_t nb_devs; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD ))); +if (nb_devs <1 ) { +TEST_ASSERT_SUCCESS (rte_vdev_init ( +RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD ),NULL ), +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD )); + } +return testsuite_params_setup (); +} + +static int +sw_kasumi_testsuite_setup (void ) +{ +int32_t nb_devs; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_KASUMI_PMD ))); +if (nb_devs <1 ) { +TEST_ASSERT_SUCCESS (rte_vdev_init ( +RTE_STR (CRYPTODEV_NAME_KASUMI_PMD ),NULL ), +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_KASUMI_PMD )); + } +return testsuite_params_setup (); +} + +static int +sw_zuc_testsuite_setup (void ) +{ +int32_t nb_devs; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_ZUC_PMD ))); +if (nb_devs <1 ) { +TEST_ASSERT_SUCCESS (rte_vdev_init ( +RTE_STR (CRYPTODEV_NAME_ZUC_PMD ),NULL ), +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_ZUC_PMD )); + } +return testsuite_params_setup (); +} + +static int +armv8_testsuite_setup (void ) +{ +int32_t nb_devs, ret; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_ARMV8_PMD ))); +if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_ARMV8_PMD ),NULL ); + +TEST_ASSERT (ret ==0 ,"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_ARMV8_PMD )); + } +return testsuite_params_setup (); +} + +static int +mrvl_testsuite_setup (void ) +{ +int32_t nb_devs, ret; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_MVSAM_PMD ))); +if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_MVSAM_PMD ),NULL ); + +TEST_ASSERT (ret ==0 ,"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_MVSAM_PMD )); + } +return testsuite_params_setup (); +} + +static int +dpaa_sec_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +dpaa2_sec_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +ccp_testsuite_setup (void ) +{ +int32_t nb_devs, ret; + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_CCP_PMD ))); +if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_CCP_PMD ),NULL ); + +TEST_ASSERT (ret ==0 ,"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_CCP_PMD )); + } +return testsuite_params_setup (); +} + +static int +octeontx_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +octeontx2_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +caam_jr_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +nitrox_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +bcmfs_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} + +static int +qat_raw_testsuite_setup (void ) +{ +return testsuite_params_setup (); +} +static void testsuite_teardown (void ) {
@@ -13069,6 +13083,59 @@ test_chacha20_poly1305_decrypt_test_case_rfc8439(void)/* global AESNI worker IDs for the scheduler test */ uint8_t aesni_ids[2 ]; +static int +scheduler_testsuite_setup (void ) +{ +uint32_t i =0 ; +int32_t nb_devs, ret; +char vdev_args[VDEV_ARGS_SIZE ] = {"" }; +char temp_str[VDEV_ARGS_SIZE ] = {"mode=multi-core," +"ordering=enable,name=cryptodev_test_scheduler,corelist=" }; +uint16_t worker_core_count =0 ; +uint16_t socket_id =0 ; + +if (gbl_driver_id ==rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ))) { + +/* Identify the Worker Cores +* Use 2 worker cores for the device args +*/ +RTE_LCORE_FOREACH_WORKER (i) { +if (worker_core_count >1 ) +break ; +snprintf (vdev_args,sizeof (vdev_args), +"%s%d" , temp_str, i); +strcpy (temp_str, vdev_args); +strlcat (temp_str,";" ,sizeof (temp_str)); + worker_core_count++; + socket_id =rte_lcore_to_socket_id (i); + } +if (worker_core_count !=2 ) { +RTE_LOG (ERR ,USER1 , +"Cryptodev scheduler test require at least " +"two worker cores to run. " +"Please use the correct coremask.\n" ); +return TEST_FAILED ; + } +strcpy (temp_str, vdev_args); +snprintf (vdev_args,sizeof (vdev_args),"%s,socket_id=%d" , + temp_str, socket_id); +RTE_LOG (DEBUG ,USER1 ,"vdev_args: %s\n" , vdev_args); + nb_devs =rte_cryptodev_device_count_by_driver ( +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ))); +if (nb_devs <1 ) { + ret =rte_vdev_init ( +RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ), + vdev_args); +TEST_ASSERT (ret ==0 , +"Failed to create instance %u of pmd : %s" , + i,RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD )); + } + } +return testsuite_params_setup (); +} +static int test_scheduler_attach_slave_op (void ) {
@@ -13243,53 +13310,63 @@ test_scheduler_mode_pkt_size_distr_op(void)return 0 ; } -static struct unit_test_suite cryptodev_scheduler_testsuite = { - .suite_name ="Crypto Device Scheduler Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { -/* Multi Core */ -TEST_CASE_ST (NULL ,NULL , test_scheduler_attach_slave_op), -TEST_CASE_ST (NULL ,NULL , test_scheduler_mode_multicore_op), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), -TEST_CASE_ST (NULL ,NULL , test_scheduler_detach_slave_op), +static int +scheduler_multicore_testsuite_setup (void ) +{ +if (test_scheduler_attach_slave_op () <0 ) +return -1 ; +if (test_scheduler_mode_op (CDEV_SCHED_MODE_MULTICORE ) <0 ) +return -1 ; +return 0 ; +} -/* Round Robin */ -TEST_CASE_ST (NULL ,NULL , test_scheduler_attach_slave_op), -TEST_CASE_ST (NULL ,NULL , test_scheduler_mode_roundrobin_op), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), -TEST_CASE_ST (NULL ,NULL , test_scheduler_detach_slave_op), +static int +scheduler_roundrobin_testsuite_setup (void ) +{ +if (test_scheduler_attach_slave_op () <0 ) +return -1 ; +if (test_scheduler_mode_op (CDEV_SCHED_MODE_ROUNDROBIN ) <0 ) +return -1 ; +return 0 ; +} -/* Fail over */ -TEST_CASE_ST (NULL ,NULL , test_scheduler_attach_slave_op), -TEST_CASE_ST (NULL ,NULL , test_scheduler_mode_failover_op), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), -TEST_CASE_ST (NULL ,NULL , test_scheduler_detach_slave_op), +static int +scheduler_failover_testsuite_setup (void ) +{ +if (test_scheduler_attach_slave_op () <0 ) +return -1 ; +if (test_scheduler_mode_op (CDEV_SCHED_MODE_FAILOVER ) <0 ) +return -1 ; +return 0 ; +} -/* PKT SIZE */ -TEST_CASE_ST (NULL ,NULL , test_scheduler_attach_slave_op), -TEST_CASE_ST (NULL ,NULL , test_scheduler_mode_pkt_size_distr_op), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), -TEST_CASE_ST (NULL ,NULL , test_scheduler_detach_slave_op), +static int +scheduler_pkt_size_distr_testsuite_setup (void ) +{ +if (test_scheduler_attach_slave_op () <0 ) +return -1 ; +if (test_scheduler_mode_op (CDEV_SCHED_MODE_PKT_SIZE_DISTR ) <0 ) +return -1 ; +return 0 ; +} -TEST_CASES_END ()/**< NULL terminate unit test array */ - } -}; +static void +scheduler_mode_testsuite_teardown (void ) +{ +test_scheduler_detach_slave_op (); +}#endif /* RTE_CRYPTO_SCHEDULER */ +static struct unit_test_suite end_testsuite = { + .suite_name =NULL , + .setup =NULL , + .teardown =NULL , + .unit_test_suites =NULL +}; +static struct unit_test_suite cryptodev_testsuite = { - .suite_name ="Crypto Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, + .suite_name ="Crypto General Unit Test Suite" , .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, test_device_configure_invalid_dev_id),
@@ -13297,25 +13374,69 @@ static struct unit_test_suite cryptodev_testsuite = { test_queue_pair_descriptor_setup),TEST_CASE_ST (ut_setup ,ut_teardown ,test_device_configure_invalid_queue_pair_ids ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_AES_chain_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_AES_cipheronly_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_3DES_chain_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_3DES_cipheronly_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_DES_cipheronly_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_AES_docsis_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_DES_docsis_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_authonly_all ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_stats ), +#ifdef RTE_LIB_SECURITY +TEST_CASE_ST (ut_setup_security ,ut_teardown , +test_PDCP_PROTO_all ), +TEST_CASE_ST (ut_setup_security ,ut_teardown , +test_DOCSIS_PROTO_all ), +#endif +TEST_CASE_ST (ut_setup ,ut_teardown ,test_enq_callback_setup ), +TEST_CASE_ST (ut_setup ,ut_teardown ,test_deq_callback_setup ), +TEST_CASES_END ()/**< NULL terminate unit test array */ + } +}; + +static struct unit_test_suite cryptodev_negative_hmac_sha1_testsuite = { + .suite_name ="Negative HMAC SHA1 Unit Test Suite" , + .unit_test_cases = { +/** Negative tests */ TEST_CASE_ST (ut_setup, ut_teardown, - test_multi_session), + authentication_verify_HMAC_SHA1_fail_data_corrupt), +TEST_CASE_ST (ut_setup, ut_teardown, + authentication_verify_HMAC_SHA1_fail_tag_corrupt), +TEST_CASE_ST (ut_setup, ut_teardown, + auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt), +TEST_CASE_ST (ut_setup, ut_teardown, + auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt), + +TEST_CASES_END ()/**< NULL terminate unit test array */ + } +}; + +static struct unit_test_suite cryptodev_multi_session_testsuite = { + .suite_name ="Multi Session Unit Test Suite" , + .unit_test_cases = { +TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session_random_usage), +TEST_CASES_END ()/**< NULL terminate unit test array */ + } +}; + +static struct unit_test_suite cryptodev_null_testsuite = { + .suite_name ="NULL Test Suite" , + .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, test_null_invalid_operation),TEST_CASE_ST (ut_setup, ut_teardown, test_null_burst_operation), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_3DES_chain_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_3DES_cipheronly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_DES_cipheronly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_AES_docsis_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_DES_docsis_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), -TEST_CASE_ST (ut_setup, ut_teardown, test_stats), +TEST_CASES_END () + } +}; -/** AES CCM Authenticated Encryption 128 bits key */ +static struct unit_test_suite cryptodev_aes_ccm_auth_testsuite = { + .suite_name ="AES CCM Authenticated Test Suite" , + .unit_test_cases = { +/** AES CCM Authenticated Encryption 128 bits key*/ TEST_CASE_ST (ut_setup, ut_teardown, test_AES_CCM_authenticated_encryption_test_case_128_1), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13362,7 +13483,13 @@ static struct unit_test_suite cryptodev_testsuite = { test_AES_CCM_authenticated_decryption_test_case_256_2),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_CCM_authenticated_decryption_test_case_256_3), + TEST_CASES_END() + } +}; +static struct unit_test_suite cryptodev_aes_gcm_auth_testsuite = { + .suite_name ="AES GCM Authenticated Test Suite" , + .unit_test_cases = {/** AES GCM Authenticated Encryption */ TEST_CASE_ST (ut_setup, ut_teardown, test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
@@ -13499,7 +13626,13 @@ static struct unit_test_suite cryptodev_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_AES_GCM_authenticated_decryption_sessionless_test_case_1), -/** AES GMAC Authentication */ + TEST_CASES_END() + } +}; + +static struct unit_test_suite cryptodev_aes_gmac_auth_testsuite = { + .suite_name ="AES GMAC Authentication Test Suite" , + .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, test_AES_GMAC_authentication_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13525,11 +13658,25 @@ static struct unit_test_suite cryptodev_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_AES_GMAC_authentication_SGL_2047B), -/** Chacha20-Poly1305 */ + TEST_CASES_END() + } +}; + +static struct unit_test_suite cryptodev_chacha20_poly1305_testsuite = { + .suite_name ="Chacha20-Poly1305 Test Suite" , + + .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, test_chacha20_poly1305_encrypt_test_case_rfc8439),TEST_CASE_ST (ut_setup, ut_teardown, test_chacha20_poly1305_decrypt_test_case_rfc8439), +TEST_CASES_END () + } +}; + +static struct unit_test_suite cryptodev_snow3g_testsuite = { + .suite_name ="SNOW 3G Test Suite" , + .unit_test_cases = {/** SNOW 3G encrypt only (UEA2) */ TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_1),
@@ -13610,6 +13757,7 @@ static struct unit_test_suite cryptodev_testsuite = { test_snow3g_hash_generate_test_case_2),TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_hash_generate_test_case_3), +/* Tests with buffers which length is not byte-aligned */ TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_hash_generate_test_case_4),
@@ -13623,6 +13771,7 @@ static struct unit_test_suite cryptodev_testsuite = { test_snow3g_hash_verify_test_case_2),TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_hash_verify_test_case_3), +/* Tests with buffers which length is not byte-aligned */ TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_hash_verify_test_case_4),
@@ -13634,7 +13783,13 @@ static struct unit_test_suite cryptodev_testsuite = { test_snow3g_cipher_auth_test_case_1),TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_auth_cipher_with_digest_test_case_1), + TEST_CASES_END() + } +}; +static struct unit_test_suite cryptodev_zuc_testsuite = { + .suite_name ="ZUC Test Suite" , + .unit_test_cases = {/** ZUC encrypt only (EEA3) */ TEST_CASE_ST (ut_setup, ut_teardown, test_zuc_encryption_test_case_1),
@@ -13692,8 +13847,13 @@ static struct unit_test_suite cryptodev_testsuite = { test_zuc_auth_cipher_verify_test_case_1_sgl),TEST_CASE_ST (ut_setup, ut_teardown, test_zuc_auth_cipher_verify_test_case_1_oop_sgl), + TEST_CASES_END() + } +}; -/** HMAC_MD5 Authentication */ +static struct unit_test_suite cryptodev_hmac_md5_auth_testsuite = { + .suite_name ="HMAC_MD5 Authentication Test Suite" , + .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, test_MD5_HMAC_generate_case_1), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13702,7 +13862,13 @@ static struct unit_test_suite cryptodev_testsuite = { test_MD5_HMAC_generate_case_2),TEST_CASE_ST (ut_setup, ut_teardown, test_MD5_HMAC_verify_case_2), + TEST_CASES_END() + } +}; +static struct unit_test_suite cryptodev_kasumi_testsuite = { + .suite_name ="Kasumi Test Suite" , + .unit_test_cases = {/** KASUMI hash only (UIA1) */ TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_hash_generate_test_case_1),
@@ -13787,17 +13953,24 @@ static struct unit_test_suite cryptodev_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_auth_cipher_verify_test_case_2_oop_sgl), -/** ESN Testcase */ + TEST_CASES_END() + } +}; + +static struct unit_test_suite cryptodev_esn_testsuite = { + .suite_name ="ESN Test Suite" , + .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, auth_encrypt_AES128CBC_HMAC_SHA1_esn_check),TEST_CASE_ST (ut_setup, ut_teardown, auth_decrypt_AES128CBC_HMAC_SHA1_esn_check), +TEST_CASES_END () + } +}; -/** Negative tests */ -TEST_CASE_ST (ut_setup, ut_teardown, - authentication_verify_HMAC_SHA1_fail_data_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - authentication_verify_HMAC_SHA1_fail_tag_corrupt), +static struct unit_test_suite cryptodev_negative_aes_gcm_testsuite = { + .suite_name ="Negative AES GCM Test Suite" , + .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, test_AES_GCM_auth_encryption_fail_iv_corrupt), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13822,16 +13995,26 @@ static struct unit_test_suite cryptodev_testsuite = { test_AES_GCM_auth_decryption_fail_aad_corrupt),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_GCM_auth_decryption_fail_tag_corrupt), + + TEST_CASES_END() + } +}; + +static struct unit_test_suite cryptodev_negative_aes_gmac_testsuite = { + .suite_name ="Negative AES GMAC Test Suite" , + .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, authentication_verify_AES128_GMAC_fail_data_corrupt),TEST_CASE_ST (ut_setup, ut_teardown, authentication_verify_AES128_GMAC_fail_tag_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt), -/** Mixed CIPHER + HASH algorithms */ +TEST_CASES_END () + } +}; + +static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite = { + .suite_name ="Mixed CIPHER + HASH algorithms Test Suite" , + .unit_test_cases = {/** AUTH AES CMAC + CIPHER AES CTR */ TEST_CASE_ST (ut_setup, ut_teardown, test_aes_cmac_aes_ctr_digest_enc_test_case_1),
@@ -13844,11 +14027,11 @@ static struct unit_test_suite cryptodev_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1),TEST_CASE_ST (ut_setup, ut_teardown, - test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop), + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop),TEST_CASE_ST (ut_setup, ut_teardown, - test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl), + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl),TEST_CASE_ST (ut_setup, ut_teardown, - test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl), + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl),/** AUTH ZUC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown,
@@ -13911,23 +14094,12 @@ static struct unit_test_suite cryptodev_testsuite = { test_auth_aes_cmac_cipher_null_test_case_1),TEST_CASE_ST (ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_null_test_case_1), - -#ifdef RTE_LIB_SECURITY -TEST_CASE_ST (ut_setup_security, ut_teardown, - test_PDCP_PROTO_all), -TEST_CASE_ST (ut_setup_security, ut_teardown, - test_DOCSIS_PROTO_all), -#endif -TEST_CASE_ST (ut_setup, ut_teardown, test_enq_callback_setup), -TEST_CASE_ST (ut_setup, ut_teardown, test_deq_callback_setup), - TEST_CASES_END() /**< NULL terminate unit test array */ + TEST_CASES_END() } }; -static struct unit_test_suite cryptodev_virtio_testsuite = { +static struct unit_test_suite cryptodev_virtio_sub_testsuite = { .suite_name ="Crypto VIRTIO Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all),
@@ -13935,15 +14107,12 @@ static struct unit_test_suite cryptodev_virtio_testsuite = { } }; -static struct unit_test_suite cryptodev_caam_jr_testsuite = { - .suite_name ="Crypto CAAM JR Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, +static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = { + .suite_name ="Crypto CAAM JR Sub Unit Test Suite" , .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, - test_device_configure_invalid_dev_id), -TEST_CASE_ST (ut_setup, ut_teardown, - test_multi_session), + test_device_configure_invalid_dev_id), +TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all),TEST_CASE_ST (ut_setup, ut_teardown, test_3DES_chain_all),
@@ -13955,58 +14124,28 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite = { } }; -static struct unit_test_suite cryptodev_mrvl_testsuite = { +static struct unit_test_suite cryptodev_mrvl_sub_testsuite = { .suite_name ="Crypto Device Marvell Component Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, .unit_test_cases = { -TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session), -TEST_CASE_ST (ut_setup, ut_teardown, - test_multi_session_random_usage),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all),TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all),TEST_CASE_ST (ut_setup, ut_teardown, test_3DES_chain_all),TEST_CASE_ST (ut_setup, ut_teardown, test_3DES_cipheronly_all), -/** Negative tests */ -TEST_CASE_ST (ut_setup, ut_teardown, - authentication_verify_HMAC_SHA1_fail_data_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - authentication_verify_HMAC_SHA1_fail_tag_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt), -TEST_CASES_END ()/**< NULL terminate unit test array */ } }; -static struct unit_test_suite cryptodev_ccp_testsuite = { +static struct unit_test_suite cryptodev_ccp_sub_testsuite = { .suite_name ="Crypto Device CCP Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, .unit_test_cases = { -TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session), -TEST_CASE_ST (ut_setup, ut_teardown, - test_multi_session_random_usage),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_cipheronly_all),TEST_CASE_ST (ut_setup, ut_teardown, test_3DES_chain_all),TEST_CASE_ST (ut_setup, ut_teardown, test_3DES_cipheronly_all),TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), -/** Negative tests */ -TEST_CASE_ST (ut_setup, ut_teardown, - authentication_verify_HMAC_SHA1_fail_data_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - authentication_verify_HMAC_SHA1_fail_tag_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt), -TEST_CASE_ST (ut_setup, ut_teardown, - auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt), -TEST_CASES_END ()/**< NULL terminate unit test array */ } };
@@ -14014,6 +14153,32 @@ static struct unit_test_suite cryptodev_ccp_testsuite = {static int test_cryptodev_qat (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="QAT Unit Test Suite" , + .setup = qat_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_QAT_SYM_PMD ));
@@ -14021,13 +14186,30 @@ test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)RTE_LOG (ERR ,USER1 ,"QAT PMD must be loaded.\n" );return TEST_SKIPPED ; } + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); -return unit_test_suite_runner (&cryptodev_testsuite); +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_virtio (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_virtio_sub_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Virtio Unit Test Suite" , + .setup = virtio_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_VIRTIO_PMD ));
@@ -14035,13 +14217,45 @@ test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)RTE_LOG (ERR ,USER1 ,"VIRTIO PMD must be loaded.\n" );return TEST_FAILED ; } + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); -return unit_test_suite_runner (&cryptodev_virtio_testsuite); +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_aesni_mb (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="AESNI_MB Unit Test Suite" , + .setup = aesni_mb_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ));
@@ -14050,14 +14264,46 @@ test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_cpu_aesni_mb (void ) {int32_t rc; +uint8_t j, i =0 ;enum rte_security_session_action_type at; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="AESNI_MB CPU Unit Test Suite" , + .setup = aesni_mb_testsuite_setup, + .teardown = testsuite_teardown + }; gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ));
@@ -14067,9 +14313,15 @@ test_cryptodev_cpu_aesni_mb(void)return TEST_SKIPPED ; } + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + at = gbl_action_type; gbl_action_type =RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO ; - rc =unit_test_suite_runner (&cryptodev_testsuite); + rc =unit_test_suite_runner (&ts); +free (ts.unit_test_suites); gbl_action_type = at;return rc; }
@@ -14077,6 +14329,32 @@ test_cryptodev_cpu_aesni_mb(void)static int test_cryptodev_openssl (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="OpenSSL Unit Test Suite" , + .setup = openssl_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_OPENSSL_PMD ));
@@ -14085,12 +14363,45 @@ test_cryptodev_openssl(void)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_aesni_gcm (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="AESNI_GCM Unit Test Suite" , + .setup = aesni_gcm_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ));
@@ -14099,14 +14410,46 @@ test_cryptodev_aesni_gcm(void)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_cpu_aesni_gcm (void ) {int32_t rc; +uint8_t j, i =0 ;enum rte_security_session_action_type at; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="AESNI_GCM CPU Unit Test Suite" , + .setup = aesni_gcm_testsuite_setup, + .teardown = testsuite_teardown + }; gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_AESNI_GCM_PMD ));
@@ -14116,9 +14459,15 @@ test_cryptodev_cpu_aesni_gcm(void)return TEST_SKIPPED ; } + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + at = gbl_action_type; gbl_action_type =RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO ; - rc =unit_test_suite_runner (&cryptodev_testsuite); + rc =unit_test_suite_runner (&ts); +free (ts.unit_test_suites); gbl_action_type = at;return rc; }
@@ -14126,6 +14475,32 @@ test_cryptodev_cpu_aesni_gcm(void)static int test_cryptodev_null (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Null Unit Test Suite" , + .setup = null_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_NULL_PMD ));
@@ -14134,12 +14509,45 @@ test_cryptodev_null(void)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_sw_snow3g (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="SW Snow3g Unit Test Suite" , + .setup = sw_snow3g_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_SNOW3G_PMD ));
@@ -14148,12 +14556,45 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_sw_kasumi (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="SW Kasumi Unit Test Suite" , + .setup = sw_kasumi_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_KASUMI_PMD ));
@@ -14162,12 +14603,45 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_sw_zuc (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="SW ZUC Unit Test Suite" , + .setup = sw_zuc_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_ZUC_PMD ));
@@ -14176,12 +14650,45 @@ test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_armv8 (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Armv8 Unit Test Suite" , + .setup = armv8_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_ARMV8_PMD ));
@@ -14190,12 +14697,46 @@ test_cryptodev_armv8(void)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_mrvl (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &cryptodev_mrvl_sub_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Crypto Device Marvell Component Test Suite" , + .setup = mrvl_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_MVSAM_PMD ));
@@ -14204,7 +14745,14 @@ test_cryptodev_mrvl(void)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_mrvl_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }#ifdef RTE_CRYPTO_SCHEDULER
@@ -14212,6 +14760,84 @@ test_cryptodev_mrvl(void)static int test_cryptodev_scheduler (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +static struct unit_test_suite scheduler_multicore = { + .suite_name ="Scheduler Multicore Unit Test Suite" , + .setup = scheduler_multicore_testsuite_setup, + .teardown = scheduler_mode_testsuite_teardown, + .unit_test_cases = { +TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), +TEST_CASE_ST (ut_setup, ut_teardown, + test_AES_cipheronly_all), +TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), +TEST_CASES_END () + } + }; +static struct unit_test_suite scheduler_round_robin = { + .suite_name ="Scheduler Round Robin Unit Test Suite" , + .setup = scheduler_roundrobin_testsuite_setup, + .teardown = scheduler_mode_testsuite_teardown, + .unit_test_cases = { +TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), +TEST_CASE_ST (ut_setup, ut_teardown, + test_AES_cipheronly_all), +TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), +TEST_CASES_END () + } + }; +static struct unit_test_suite scheduler_failover = { + .suite_name ="Scheduler Failover Unit Test Suite" , + .setup = scheduler_failover_testsuite_setup, + .teardown = scheduler_mode_testsuite_teardown, + .unit_test_cases = { +TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), +TEST_CASE_ST (ut_setup, ut_teardown, + test_AES_cipheronly_all), +TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), +TEST_CASES_END () + } + }; +static struct unit_test_suite scheduler_pkt_size_distr = { + .suite_name ="Scheduler Pkt Size Distr Unit Test Suite" , + .setup = scheduler_pkt_size_distr_testsuite_setup, + .teardown = scheduler_mode_testsuite_teardown, + .unit_test_cases = { +TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all), +TEST_CASE_ST (ut_setup, ut_teardown, + test_AES_cipheronly_all), +TEST_CASE_ST (ut_setup, ut_teardown, test_authonly_all), +TEST_CASES_END () + } + }; +struct unit_test_suite *sched_mode_suites[] = { + &scheduler_multicore, + &scheduler_round_robin, + &scheduler_failover, + &scheduler_pkt_size_distr + }; +static struct unit_test_suite scheduler_config = { + .suite_name ="Crypto Device Scheduler Config Unit Test Suite" , + .unit_test_cases = { +TEST_CASE (test_scheduler_attach_slave_op), +TEST_CASE (test_scheduler_mode_multicore_op), +TEST_CASE (test_scheduler_mode_roundrobin_op), +TEST_CASE (test_scheduler_mode_failover_op), +TEST_CASE (test_scheduler_mode_pkt_size_distr_op), +TEST_CASE (test_scheduler_detach_slave_op), + +TEST_CASES_END ()/**< NULL terminate array */ + } + }; +struct unit_test_suite *static_suites[] = { + &scheduler_config, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Scheduler Unit Test Suite" , + .setup = scheduler_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_SCHEDULER_PMD ));
@@ -14224,8 +14850,17 @@ test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/) RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) == -1) {RTE_LOG (ERR ,USER1 ,"AESNI MB PMD must be loaded.\n" );return TEST_SKIPPED ; -} -return unit_test_suite_runner (&cryptodev_scheduler_testsuite); + } + + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * + (RTE_DIM (static_suites) +RTE_DIM (sched_mode_suites))); +ADD_STATIC_TESTSUITE (i, ts, sched_mode_suites, +RTE_DIM (sched_mode_suites)); +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }REGISTER_TEST_COMMAND (cryptodev_scheduler_autotest, test_cryptodev_scheduler);
@@ -14235,6 +14870,32 @@ REGISTER_TEST_COMMAND(cryptodev_scheduler_autotest, test_cryptodev_scheduler);static int test_cryptodev_dpaa2_sec (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="DPAA2 Sec Test Suite" , + .setup = dpaa2_sec_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_DPAA2_SEC_PMD ));
@@ -14243,12 +14904,45 @@ test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_dpaa_sec (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="DPAA Sec Test Suite" , + .setup = dpaa_sec_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_DPAA_SEC_PMD ));
@@ -14257,12 +14951,32 @@ test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_SKIPPED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_ccp (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_ccp_sub_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Crypto Device CCP Unit Test Suite" , + .setup = ccp_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_CCP_PMD ));
@@ -14271,36 +14985,124 @@ test_cryptodev_ccp(void)return TEST_FAILED ; } -return unit_test_suite_runner (&cryptodev_ccp_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_octeontx (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="OcteonTX Unit Test Suite" , + .setup = octeontx_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_OCTEONTX_SYM_PMD )); +if (gbl_driver_id ==-1 ) {RTE_LOG (ERR ,USER1 ,"OCTEONTX PMD must be loaded.\n" );return TEST_FAILED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_octeontx2 (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="OcteonTX2 Unit Test Suite" , + .setup = octeontx2_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_OCTEONTX2_PMD )); +if (gbl_driver_id ==-1 ) {RTE_LOG (ERR ,USER1 ,"OCTEON TX2 PMD must be loaded.\n" );return TEST_FAILED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_caam_jr (void /*argv __rte_unused, int argc __rte_unused*/ ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_caam_jr_sub_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Crypto CAAM JR Unit Test Suite" , + .setup = caam_jr_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_CAAM_JR_PMD ));
@@ -14309,12 +15111,45 @@ test_cryptodev_caam_jr(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_FAILED ; } -return unit_test_suite_runner (&cryptodev_caam_jr_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_nitrox (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="Nitrox Unit Test Suite" , + .setup = nitrox_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_NITROX_PMD ));
@@ -14323,12 +15158,45 @@ test_cryptodev_nitrox(void)return TEST_FAILED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_bcmfs (void ) { +uint8_t ret, j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="BCMFS Unit Test Suite" , + .setup = bcmfs_testsuite_setup, + .teardown = testsuite_teardown + }; + gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_BCMFS_PMD ));
@@ -14337,13 +15205,45 @@ test_cryptodev_bcmfs(void)return TEST_FAILED ; } -return unit_test_suite_runner (&cryptodev_testsuite); + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); + ret =unit_test_suite_runner (&ts); + +free (ts.unit_test_suites); +return ret; }static int test_cryptodev_qat_raw_api (void /*argv __rte_unused, int argc __rte_unused*/ ) {int ret; +uint8_t j, i =0 ; +struct unit_test_suite *static_suites[] = { + &cryptodev_multi_session_testsuite, + &cryptodev_null_testsuite, + &cryptodev_aes_ccm_auth_testsuite, + &cryptodev_aes_gcm_auth_testsuite, + &cryptodev_aes_gmac_auth_testsuite, + &cryptodev_snow3g_testsuite, + &cryptodev_chacha20_poly1305_testsuite, + &cryptodev_zuc_testsuite, + &cryptodev_hmac_md5_auth_testsuite, + &cryptodev_kasumi_testsuite, + &cryptodev_esn_testsuite, + &cryptodev_negative_aes_gcm_testsuite, + &cryptodev_negative_aes_gmac_testsuite, + &cryptodev_mixed_cipher_hash_testsuite, + &cryptodev_negative_hmac_sha1_testsuite, + &cryptodev_testsuite, + &end_testsuite + }; +struct unit_test_suite ts = { + .suite_name ="QAT Raw Unit Test Suite" , + .setup = qat_raw_testsuite_setup, + .teardown = testsuite_teardown + }; gbl_driver_id =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_QAT_SYM_PMD ));
@@ -14353,8 +15253,13 @@ test_cryptodev_qat_raw_api(void /*argv __rte_unused, int argc __rte_unused*/)return TEST_SKIPPED ; } + ts.unit_test_suites =malloc (sizeof (struct unit_test_suite *) * +RTE_DIM (static_suites)); + +ADD_STATIC_TESTSUITE (i, ts, static_suites,RTE_DIM (static_suites)); global_api_test_type =CRYPTODEV_RAW_API_TEST ; - ret =unit_test_suite_runner (&cryptodev_testsuite); + ret =unit_test_suite_runner (&ts); +free (ts.unit_test_suites); global_api_test_type =CRYPTODEV_API_TEST ;return ret;
Signature · 1 line
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
Hi Ciara,
//snip
Quoted 20 lines
app/test/test_cryptodev.c +13
-0nb_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 )));
app/test/test_cryptodev.c testsuite_setup(void) · line 655
Quoted 10 lines
app/test/test_cryptodev.c +9
-0+if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ),NULL ); + +TEST_ASSERT (ret ==0 , +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD )); + } +return testsuite_params_setup (); +}
Why is it required to have a separate function for each of the PMD?
I believe a single function with an argument should be sufficient.
And in that single function a simple switch case may process the vdevs differently.
As of now, it looks that moving the unnecessary duplicate code from one place to another.
This was one cleanup we have been looking forward to from quite some time. Every time a new PMD comes, a separate function is formed and the length of the code increases.
//snip
Quoted 32 lines
app/test/test_cryptodev.c +1
-3-static struct unit_test_suite cryptodev_virtio_testsuite = { +static struct unit_test_suite cryptodev_virtio_sub_testsuite = { .suite_name ="Crypto VIRTIO Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_cipheronly_all),app/test/test_cryptodev.c +4
-7@@ -13935,15 +14107,12 @@ static struct unit_test_suite cryptodev_virtio_testsuite = { } }; -static struct unit_test_suite cryptodev_caam_jr_testsuite = { - .suite_name ="Crypto CAAM JR Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, +static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = { + .suite_name ="Crypto CAAM JR Sub Unit Test Suite" , .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, - test_device_configure_invalid_dev_id), -TEST_CASE_ST (ut_setup, ut_teardown, - test_multi_session), + test_device_configure_invalid_dev_id), +TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all),(quoted diff) +0
-0TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
Review static struct unit_test_suite · line 14126
Quoted 3 lines
(quoted diff) +0
-0@@ -13955,58 +14124,28 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite = { } };
Splitting the complete testsuite into logical generic algo based sub testsuite Is a good idea. I appreciate that.
But introducing PMD based test suite is not recommended. We have been trying from past few releases to clean this up. And this patch is again introducing the same. When I first saw this series, I saw only the algo based splitting and when it was run on the board, it was showing results in an organized way. But this was not expected that, PMD based test suites are reintroduced by Intel who helped in removing them in last few releases.
This will make an unnecessary addition of duplicate code whenever a new PMD is introduced.
I recommend to use a single parent suite - cryptodev_testsuite and there Can be multiple sub testsuites based on Algos etc. but not on the basis of PMD.
Regards,
Akhil
Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
13/04/2021 19:51, Akhil Goyal:
Quoted 10 lines
Splitting the complete testsuite into logical generic algo based sub testsuite Is a good idea. I appreciate that.
But introducing PMD based test suite is not recommended. We have been trying from past few releases to clean this up. And this patch is again introducing the same. When I first saw this series, I saw only the algo based splitting and when it was run on the board, it was showing results in an organized way. But this was not expected that, PMD based test suites are reintroduced by Intel who helped in removing them in last few releases.
Quoted 5 lines
This will make an unnecessary addition of duplicate code whenever a new PMD is introduced.
I recommend to use a single parent suite -
cryptodev_testsuiteand there Can be multiple sub testsuites based on Algos etc. but not on the basis of PMD.
+1
If a PMD has specifics, it should be expressed through the API, with capabilities or any other generic way.
Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
In reply to Akhil GoyalQuoted 42 lines · Akhil Goyal
Hi Ciara,
//snip
Quoted 20 lines
nb_devs = rte_cryptodev_count(); if (nb_devs < 1) { RTE_LOG(WARNING, USER1, "No crypto devices found?\n");app/test/test_cryptodev.c +13
-0@@ -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 )));app/test/test_cryptodev.c testsuite_setup(void) · line 655
Quoted 10 lines
app/test/test_cryptodev.c +9
-0+if (nb_devs <1 ) { + ret =rte_vdev_init (RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD ),NULL ); + +TEST_ASSERT (ret ==0 , +"Failed to create instance of pmd : %s" , +RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD )); + } +return testsuite_params_setup (); +}Why is it required to have a separate function for each of the PMD?
I believe a single function with an argument should be sufficient.
And in that single function a simple switch case may process the vdevs differently.As of now, it looks that moving the unnecessary duplicate code from one place to another.
Quoted 6 lines
This was one cleanup we have been looking forward to from quite some time. Every time a new PMD comes, a separate function is formed and the length of the code increases.
//snip
The virtual device creation code could be dropped completely if user is guaranteed to create the required crypto PMD from EAL devargs and we could assume that the first crypto device of the test suite type is always used?
Quoted 46 lines
Quoted 32 lines
app/test/test_cryptodev.c +1
-3-static struct unit_test_suite cryptodev_virtio_testsuite = { +static struct unit_test_suite cryptodev_virtio_sub_testsuite = { .suite_name ="Crypto VIRTIO Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_cipheronly_all),app/test/test_cryptodev.c +4
-7@@ -13935,15 +14107,12 @@ static struct unit_test_suite cryptodev_virtio_testsuite = { } }; -static struct unit_test_suite cryptodev_caam_jr_testsuite = { - .suite_name ="Crypto CAAM JR Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, +static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = { + .suite_name ="Crypto CAAM JR Sub Unit Test Suite" , .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, - test_device_configure_invalid_dev_id), -TEST_CASE_ST (ut_setup, ut_teardown, - test_multi_session), + test_device_configure_invalid_dev_id), +TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all),
TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),Review static struct unit_test_suite · line 14126
Quoted 3 lines
(quoted diff) +0
-0@@ -13955,58 +14124,28 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite = { } };Splitting the complete testsuite into logical generic algo based sub testsuite Is a good idea. I appreciate that.
But introducing PMD based test suite is not recommended. We have been trying from past few releases to clean this up. And this patch is again introducing the same. When I first saw this series, I saw only the algo based splitting and when it was run on the board, it was showing results in an organized way. But this was not expected that, PMD based test suites are reintroduced by Intel who helped in removing them in last few releases.
Quoted 9 lines
This will make an unnecessary addition of duplicate code whenever a new PMD is introduced.
I recommend to use a single parent suite -
cryptodev_testsuiteand there Can be multiple sub testsuites based on Algos etc. but not on the basis of PMD.Regards,
Akhil
Hey Akhil, I understand the sentiment of this, we were just trying to avoid necessary failures by executing testsuites which aren't supported by the PMD under test, and we're confident that all testsuites/tests are correctly verifying their capabilities requirements. If we add some code into the testsuite setup functions to test capabilities required for the testsuites vs those required by the PMD then we could do as you are suggesting. If we can make this change quickly would you consider this patchset for inclusion in RC2?
Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
Hi Declan,
Quoted 48 lines
Quoted 28 lines
//snip
Quoted 26 lines
nb_devs = rte_cryptodev_count(); if (nb_devs < 1) { RTE_LOG(WARNING, USER1, "No crypto devices found?\n");app/test/test_cryptodev.c +18
-0@@ -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",Quoted 8 lines
app/test/test_cryptodev.c testsuite_setup(void) · line 654
Quoted 4 lines
app/test/test_cryptodev.c +4
-0+ RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); + } +return testsuite_params_setup (); +}Why is it required to have a separate function for each of the PMD? I believe a single function with an argument should be sufficient. And in that single function a simple switch case may process the vdevs
differently.
Quoted 5 lines
As of now, it looks that moving the unnecessary duplicate code from one place to another.
This was one cleanup we have been looking forward to from quite some
time.
Quoted 1 line
Every time a new PMD comes, a separate function is formed and the length
of
Quoted 3 lines
the code increases.
Quoted 6 lines
Quoted 1 line
//snip
The virtual device creation code could be dropped completely if user is guaranteed to create the required crypto PMD from EAL devargs and we could assume that the first crypto device of the test suite type is always used?
Agreed.
Quoted 61 lines
Quoted 40 lines
Quoted 33 lines
app/test/test_cryptodev.c +1
-3-static struct unit_test_suite cryptodev_virtio_testsuite = { +static struct unit_test_suite cryptodev_virtio_sub_testsuite = { .suite_name ="Crypto VIRTIO Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_cipheronly_all),app/test/test_cryptodev.c +4
-7@@ -13935,15 +14107,12 @@ static struct unit_test_suite cryptodev_virtio_testsuite = { } }; -static struct unit_test_suite cryptodev_caam_jr_testsuite = { - .suite_name ="Crypto CAAM JR Unit Test Suite" , - .setup = testsuite_setup, - .teardown = testsuite_teardown, +static struct unit_test_suite cryptodev_caam_jr_sub_testsuite = { + .suite_name ="Crypto CAAM JR Sub Unit Test Suite" , .unit_test_cases = {TEST_CASE_ST (ut_setup, ut_teardown, - test_device_configure_invalid_dev_id), -TEST_CASE_ST (ut_setup, ut_teardown, - test_multi_session), + test_device_configure_invalid_dev_id), +TEST_CASE_ST (ut_setup, ut_teardown, test_multi_session),TEST_CASE_ST (ut_setup, ut_teardown, test_AES_chain_all),
TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),Review static struct unit_test_suite · line 14126
Quoted 3 lines
(quoted diff) +0
-0@@ -13955,58 +14124,28 @@ static struct unit_test_suite cryptodev_caam_jr_testsuite = { } };Splitting the complete testsuite into logical generic algo based sub testsuite Is a good idea. I appreciate that.
Quoted 2 lines
But introducing PMD based test suite is not recommended. We have been trying from past few releases to clean this up. And this patch is again
introducing
Quoted 1 line
the same. When I first saw this series, I saw only the algo based splitting
and
Quoted 5 lines
when it was run on the board, it was showing results in an organized way. But this was not expected that, PMD based test suites are reintroduced by Intel who helped in removing them in last few releases.
This will make an unnecessary addition of duplicate code whenever a new
PMD
Quoted 4 lines
is introduced.
I recommend to use a single parent suite -
cryptodev_testsuiteand there Can be multiple sub testsuites based on Algos etc. but not on the basis ofPMD.
Quoted 4 lines
Regards,
Akhil
Quoted 8 lines
Hey Akhil, I understand the sentiment of this, we were just trying to avoid necessary failures by executing testsuites which aren't supported by the PMD under test, and we're confident that all testsuites/tests are correctly verifying their capabilities requirements. If we add some code into the testsuite setup functions to test capabilities required for the testsuites vs those required by the PMD then we could do as you are suggesting. If we can make this change quickly would you consider this patchset for inclusion in RC2?
I can take these patches upto RC2.
Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
14/04/2021 13:18, Akhil Goyal:
Quoted 33 lines
Quoted 24 lines
Quoted 5 lines
Splitting the complete testsuite into logical generic algo based sub testsuite Is a good idea. I appreciate that.
But introducing PMD based test suite is not recommended. We have been trying from past few releases to clean this up. And this patch is again
introducing
Quoted 1 line
the same. When I first saw this series, I saw only the algo based splitting
and
Quoted 5 lines
when it was run on the board, it was showing results in an organized way. But this was not expected that, PMD based test suites are reintroduced by Intel who helped in removing them in last few releases.
This will make an unnecessary addition of duplicate code whenever a new
PMD
Quoted 4 lines
is introduced.
I recommend to use a single parent suite -
cryptodev_testsuiteand there Can be multiple sub testsuites based on Algos etc. but not on the basis ofPMD.
Quoted 4 lines
Regards,
AkhilQuoted 8 lines
Hey Akhil, I understand the sentiment of this, we were just trying to avoid necessary failures by executing testsuites which aren't supported by the PMD under test, and we're confident that all testsuites/tests are correctly verifying their capabilities requirements. If we add some code into the testsuite setup functions to test capabilities required for the testsuites vs those required by the PMD then we could do as you are suggesting. If we can make this change quickly would you consider this patchset for inclusion in RC2?
Quoted 1 line
I can take these patches upto RC2.
Please don't merge patches which go in the wrong direction.
Re: [dpdk-dev] [EXT] [PATCH v2 3/6] test/crypto: refactor to use sub-testsuites
Quoted 40 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Splitting the complete testsuite into logical generic algo based sub
testsuite
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Is a good idea. I appreciate that.
But introducing PMD based test suite is not recommended. We have
been
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
trying from past few releases to clean this up. And this patch is again
introducing
Quoted 1 line
the same. When I first saw this series, I saw only the algo based splitting
and
Quoted 1 line
when it was run on the board, it was showing results in an organized
way.
Quoted 1 line
Quoted 1 line
Quoted 1 line
But this was not expected that, PMD based test suites are reintroduced
by
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Intel who helped in removing them in last few releases.
This will make an unnecessary addition of duplicate code whenever a
new
Quoted 4 lines
Quoted 4 lines
PMD
Quoted 3 lines
is introduced.
I recommend to use a single parent suite -
cryptodev_testsuiteandthere
Quoted 1 line
Quoted 1 line
Quoted 1 line
Can be multiple sub testsuites based on Algos etc. but not on the basis
of
Quoted 15 lines
Quoted 14 lines
PMD.
Quoted 4 lines
Regards,
AkhilHey Akhil, I understand the sentiment of this, we were just trying to avoid necessary failures by executing testsuites which aren't supported by the PMD under test, and we're confident that all testsuites/tests are correctly verifying their capabilities requirements. If we add some code into the testsuite setup functions to test capabilities required for the testsuites vs those required by the PMD then we could do as you are suggesting. If we can make this change quickly would you consider this patchset for inclusion in RC2?
Quoted 4 lines
Quoted 1 line
I can take these patches upto RC2.
Please don't merge patches which go in the wrong direction.
I agreed to take patches by RC2, if above comments are addressed.
PATCH v2 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 = { -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 v2 5/6 test/crypto: fix return value on test skipped
In reply to Ciara PowerThe blockcipher testcase return value TEST_SUCCESS was incorrect for one conditional check, it should have been TEST_SKIPPED similar to the other condition checks in this function when the testcase is skipped.
--- app/test/test_cryptodev_blockcipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cryptodev_blockcipher.c +1 -1
@@ -160,7 +160,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,printf ("Raw Data Path APIs do not support OOP, " "Test Skipped.\n" );snprintf (test_msg,BLOCKCIPHER_TEST_MSG_LEN ,"SKIPPED" ); - status =TEST_SUCCESS ; + status =TEST_SKIPPED ; goto error_exit; } }
Signature · 1 line
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v2 5/6] test/crypto: fix return value on test skipped
Quoted 10 lines
The blockcipher testcase return value
TEST_SUCCESSwas incorrect for one conditional check, it should have beenTEST_SKIPPEDsimilar to the other condition checks in this function when the testcase is skipped.Fixes 4868f6591c6f ("test/crypto: add cases for raw datapath API")Signed-off-by Ciara Power <[email protected]>---
PATCH v2 6/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.
---
v2:
- Squashed release note patch into this patch.
- Modified the build blockcipher suite function to use the testcases flexible array, and return a testsuite pointer.
--- app/test/test.c | 11 +- app/test/test.h | 16 +- app/test/test_cryptodev.c | 507 +++++++++++++++---------- app/test/test_cryptodev_blockcipher.c | 125 +++--- app/test/test_cryptodev_blockcipher.h | 12 +- doc/guides/rel_notes/release_21_05.rst | 5 + 6 files changed, 407 insertions(+), 269 deletions(-)
app/test/test.c +9 -2
@@ -38,7 +38,8 @@ extern cmdline_parse_ctx_t main_ctx[];#define FOR_EACH_SUITE_TESTCASE (iter, suite, case) \ for (iter = 0, case = suite->unit_test_cases[0]; \ - suite->unit_test_cases[iter].testcase; \ + suite->unit_test_cases[iter].testcase || \ + suite->unit_test_cases[iter].testcase_with_data; \ iter++, case = suite->unit_test_cases[iter])#define FOR_EACH_SUITE_TESTSUITE (iter, suite, sub_ts) \
@@ -328,7 +329,13 @@ unit_test_suite_runner(struct unit_test_suite *suite)if (test_success ==TEST_SUCCESS ) {/* run the test case */ - test_success = tc.testcase (); +if (tc.testcase) + test_success = tc.testcase (); +else if (tc.testcase_with_data) + test_success = tc.testcase_with_data (tc.data); +else + test_success = -ENOTSUP ; +if (test_success ==TEST_SUCCESS ) suite->succeeded++;else if (test_success ==TEST_SKIPPED )
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 -203
938 lines not on this page · raw message
app/test/test_cryptodev_blockcipher.c +74 -51
156 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_ */
doc/guides/rel_notes/release_21_05.rst +5 -0
@@ -126,6 +126,11 @@ New Features * Added command to display Rx queue used descriptor count. ``show port (port_id) rxq (queue_id) desc used count`` +* **Added sub-testsuite support.** + + * The unit test suite struct now supports having either a nested + list of sub-testsuites, or a list of testcases as before. + Removed Items -------------
Signature · 1 line
2.25.1
Quoted 79 lines
-----Original Message-----
From: Ciara Power <[email protected]>
Sent: Friday, April 2, 2021 10:24 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Ruifeng Wang <[email protected]>; [email protected]; Ajit Khaparde ([email protected]) <[email protected]>; [email protected]; Ciara Power <[email protected]>
Subject: [PATCH v2 0/6] test: refactor crypto unit test frameworkv2:
- Added macro in place of testcase/testsuite loops.
- Added more detail in the summary output.
- Moved testcase counts to the testsuite structure.
- Flattened testsuite structure to remove union.
- Added patch for fix of blockcipher test return value.
- Squashed release note into last patch.The current crypto unit test framework is not granular enough to accurately track unit test results. This is caused by one testcase in a suite actually running multiple testcases, but only returning one result.
The approach taken in this patchset allows a test suite have either a list of sub-testsuites, or a list of testcases as previously used.
The unit test suite runner can then recursively iterate and run the sub- testsuites, until it reaches a suite with testcases, and it then runs each testcase as it had done previously.By allowing this further breakdown into sub-testsuites, a refactor of the crypto unit tests solves the issue of inaccurate reporting, as sub-testsuites can be used in place of the testcases that had multiple testcases hidden on a sub level.
The blockcipher tests previously had these hidden testcases, but are now sub-testsuites that are dynamically created and added to a parent test suite, allowing for each testcase status to be reported directly to the runner. The cryptodev test suite is broken down into smaller suites that are used as sub-testsuites, which allows for more flexibility choosing which sub- testsuites should run for the current device autotest.
The introduction of sub-testsuites also allows for more precise setup/teardown functions, rather than general ones loaded with conditions as was seen with the initial setup function used for all crypto testsuites.For example, when running the
cryptodev_aesni_mb_autotest, the AESNI MB parent test suite has its own setup function to initialise the AESNI MB device.
Various sub-testsuites are added to the parent test suite, such as some of the static suites that were once in 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: fix return value on test skipped test/crypto: dynamically build blockcipher suiteapp/test/test.c | 226 ++- app/test/test.h | 23 +- app/test/test_cryptodev.c | 1964 ++++++++++++++++++------ app/test/test_cryptodev.h | 20 + app/test/test_cryptodev_asym.c | 93 +- app/test/test_cryptodev_blockcipher.c | 127 +- app/test/test_cryptodev_blockcipher.h | 12 +- app/test/test_ipsec.c | 32 +- doc/guides/rel_notes/release_21_05.rst | 5 + 9 files changed, 1831 insertions(+), 671 deletions(-)
Quoted 2 lines
--
2.25.1
Tested against armv8crypto PMD and the result looks good.