[v6,0/3] Refactor crypto unit tests.
mbox series

Message ID 20200117144651.26804-1-adamx.dybkowski@intel.com
Headers show
Series
  • Refactor crypto unit tests.
Related show

Message

Adam Dybkowski Jan. 17, 2020, 2:46 p.m. UTC
This patch set is a first step to refactor the overly complex symmetric
crypto unit tests. It merges many separate arrays of the tests
for these PMDs: null, aesni_mb, aesni_gcm, openssl, qat, sw_snow3g,
sw_kasumi, sw_zuc into one big array that's then used when running
unit tests on these PMDs.

Individual test functions check the capabilities and execute the rest
of the test or skip (return -ENOTSUP) based on the particular test
requirements - e.g. test if PMD supports ZUC algo or even a particular
key length in few cases. Few edge cases required to check the PMD
itself (e.g. run on QAT only, or skip on AES NI / AES GCM). 

It's the first step of bigger refactoring. Maintainers of other PMDs
are encouraged to add their PMD unit tests also into this big central
array and remove individual test macro arrays.

This patch doesn't address next refactoring steps to be done in the
future: geting rid of many small (usually 1-2 line) test functions,
created separately for every test case; and simplifying many bigger
functions that currently do similar things but work on different
test vector structures.

A simple script to check if symmetric crypto unit tests work properly
on multiple PMDs at once, update the PMDs list to your needs:

for PMD in null aesni_mb aesni_gcm openssl qat scheduler sw_snow3g sw_kasumi sw_zuc
do
    echo +++++ $PMD +++++
    echo cryptodev_${PMD}_autotest | build/app/test -c7 -n1 --log-level=7 | grep ' Tests [Failed|Passed]'
done

---
v2:
* Update the cover letter, regenerate the patch file.
v3:
* Break very large commit into four smaller commits, easier to review.
* Show in the cover letter how to run unit tests on multiple PMDs at once.
v4:
* Rebase.
v5:
* Fix a test failing on SW ZUC PMD.
v6:
* Rebase again, squash first two commits to allow building individual patches.

Adam Dybkowski (3):
  test/crypto: refactor unit tests
  test/crypto: add capability checks
  test/crypto: refactor unit tests into one combined array

 app/test/test_cryptodev.c                  | 15975 +++++++++----------
 app/test/test_cryptodev_blockcipher.c      |     2 +-
 app/test/test_cryptodev_des_test_vectors.h |     6 +-
 3 files changed, 7335 insertions(+), 8648 deletions(-)

Comments

Trahe, Fiona Jan. 17, 2020, 2:56 p.m. UTC | #1
> -----Original Message-----
> From: Dybkowski, AdamX <adamx.dybkowski@intel.com>
> Sent: Friday, January 17, 2020 2:47 PM
> To: dev@dpdk.org; Trahe, Fiona <fiona.trahe@intel.com>; akhil.goyal@nxp.com
> Cc: Dybkowski, AdamX <adamx.dybkowski@intel.com>
> Subject: [PATCH v6 0/3] Refactor crypto unit tests.
> 
> This patch set is a first step to refactor the overly complex symmetric
> crypto unit tests. It merges many separate arrays of the tests
> for these PMDs: null, aesni_mb, aesni_gcm, openssl, qat, sw_snow3g,
> sw_kasumi, sw_zuc into one big array that's then used when running
> unit tests on these PMDs.
> 
> Individual test functions check the capabilities and execute the rest
> of the test or skip (return -ENOTSUP) based on the particular test
> requirements - e.g. test if PMD supports ZUC algo or even a particular
> key length in few cases. Few edge cases required to check the PMD
> itself (e.g. run on QAT only, or skip on AES NI / AES GCM).
> 
> It's the first step of bigger refactoring. Maintainers of other PMDs
> are encouraged to add their PMD unit tests also into this big central
> array and remove individual test macro arrays.
> 
> This patch doesn't address next refactoring steps to be done in the
> future: geting rid of many small (usually 1-2 line) test functions,
> created separately for every test case; and simplifying many bigger
> functions that currently do similar things but work on different
> test vector structures.
> 
> A simple script to check if symmetric crypto unit tests work properly
> on multiple PMDs at once, update the PMDs list to your needs:
> 
> for PMD in null aesni_mb aesni_gcm openssl qat scheduler sw_snow3g sw_kasumi sw_zuc
> do
>     echo +++++ $PMD +++++
>     echo cryptodev_${PMD}_autotest | build/app/test -c7 -n1 --log-level=7 | grep ' Tests
> [Failed|Passed]'
> done
> 
> ---
> v2:
> * Update the cover letter, regenerate the patch file.
> v3:
> * Break very large commit into four smaller commits, easier to review.
> * Show in the cover letter how to run unit tests on multiple PMDs at once.
> v4:
> * Rebase.
> v5:
> * Fix a test failing on SW ZUC PMD.
> v6:
> * Rebase again, squash first two commits to allow building individual patches.
> 
> Adam Dybkowski (3):
>   test/crypto: refactor unit tests
>   test/crypto: add capability checks
>   test/crypto: refactor unit tests into one combined array
> 
>  app/test/test_cryptodev.c                  | 15975 +++++++++----------
>  app/test/test_cryptodev_blockcipher.c      |     2 +-
>  app/test/test_cryptodev_des_test_vectors.h |     6 +-
>  3 files changed, 7335 insertions(+), 8648 deletions(-)
> 
> --
> 2.17.1
Series-acked-by: Fiona Trahe <fiona.trahe@intel.com>
Akhil Goyal Jan. 20, 2020, 10:02 a.m. UTC | #2
Hi Adam,
> 
> This patch set is a first step to refactor the overly complex symmetric
> crypto unit tests. It merges many separate arrays of the tests
> for these PMDs: null, aesni_mb, aesni_gcm, openssl, qat, sw_snow3g,
> sw_kasumi, sw_zuc into one big array that's then used when running
> unit tests on these PMDs.
> 
> Individual test functions check the capabilities and execute the rest
> of the test or skip (return -ENOTSUP) based on the particular test
> requirements - e.g. test if PMD supports ZUC algo or even a particular
> key length in few cases. Few edge cases required to check the PMD
> itself (e.g. run on QAT only, or skip on AES NI / AES GCM).
> 
> It's the first step of bigger refactoring. Maintainers of other PMDs
> are encouraged to add their PMD unit tests also into this big central
> array and remove individual test macro arrays.
> 
> This patch doesn't address next refactoring steps to be done in the
> future: geting rid of many small (usually 1-2 line) test functions,
> created separately for every test case; and simplifying many bigger
> functions that currently do similar things but work on different
> test vector structures.
> 
> A simple script to check if symmetric crypto unit tests work properly
> on multiple PMDs at once, update the PMDs list to your needs:
> 
> for PMD in null aesni_mb aesni_gcm openssl qat scheduler sw_snow3g
> sw_kasumi sw_zuc
> do
>     echo +++++ $PMD +++++
>     echo cryptodev_${PMD}_autotest | build/app/test -c7 -n1 --log-level=7 | grep
> ' Tests [Failed|Passed]'
> done
> 
> ---
> v2:
> * Update the cover letter, regenerate the patch file.
> v3:
> * Break very large commit into four smaller commits, easier to review.
> * Show in the cover letter how to run unit tests on multiple PMDs at once.
> v4:
> * Rebase.
> v5:
> * Fix a test failing on SW ZUC PMD.
> v6:
> * Rebase again, squash first two commits to allow building individual patches.
> 
> Adam Dybkowski (3):
>   test/crypto: refactor unit tests
>   test/crypto: add capability checks
>   test/crypto: refactor unit tests into one combined array
> 
>  app/test/test_cryptodev.c                  | 15975 +++++++++----------
>  app/test/test_cryptodev_blockcipher.c      |     2 +-
>  app/test/test_cryptodev_des_test_vectors.h |     6 +-
>  3 files changed, 7335 insertions(+), 8648 deletions(-)
> 
> --
> 2.17.1

This patchset is breaking the AES integrity cases.