From: Dmitry Eremin-Solenikov <[email protected]>

Fail the test if we were not able to match any test vectors to
capabilities.

Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
/** Email created from pull request 367 (lumag:crypto-untested)
 ** https://github.com/Linaro/odp/pull/367
 ** Patch: https://github.com/Linaro/odp/pull/367.patch
 ** Base sha: a5f07dbf95f982b7c5898434e56164ff976c0a0f
 ** Merge commit sha: 0f2debefe973066bf83f4d93a551f16f758b0c14
 **/
 test/validation/api/crypto/odp_crypto_test_inp.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c 
b/test/validation/api/crypto/odp_crypto_test_inp.c
index 48a1c3a5c..ddf638001 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -434,6 +434,8 @@ static void check_alg(odp_crypto_op_t op,
        int rc, cipher_num, auth_num, i;
        odp_bool_t cipher_tested[MAX_ALG_CAPA];
        odp_bool_t auth_tested[MAX_ALG_CAPA];
+       odp_bool_t cipher_ok = false;
+       odp_bool_t auth_ok = false;
        size_t idx;
 
        rc = odp_crypto_capability(&capa);
@@ -552,21 +554,29 @@ static void check_alg(odp_crypto_op_t op,
                auth_tested[auth_idx] = true;
        }
 
-       for (i = 0; i < cipher_num; i++)
+       for (i = 0; i < cipher_num; i++) {
+               cipher_ok |= cipher_tested[i];
                if (!cipher_tested[i])
                        printf("\n    Untested: alg=%s, key_len=%" PRIu32 ", "
                               "iv_len=%" PRIu32 "\n",
                               cipher_alg_name(cipher_alg),
                               cipher_capa[i].key_len,
                               cipher_capa[i].iv_len);
+       }
 
-       for (i = 0; i < auth_num; i++)
+       for (i = 0; i < auth_num; i++) {
+               auth_ok |= auth_tested[i];
                if (!auth_tested[i])
                        printf("\n    Untested: alg=%s, key_len=%" PRIu32 ", "
                               "digest_len=%" PRIu32 "\n",
                               auth_alg_name(auth_alg),
                               auth_capa[i].key_len,
                               auth_capa[i].digest_len);
+       }
+
+       /* Verify that we were able to run at least several tests */
+       CU_ASSERT(cipher_ok);
+       CU_ASSERT(auth_ok);
 }
 
 /**

Reply via email to