diff mbox series

[v1,3/4] validation: crypto: fail if no tests were executed

Message ID 1515027610-31156-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/4] validation: crypto: print untested capabilities | expand

Commit Message

Github ODP bot Jan. 4, 2018, 1 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 379 (lumag:crypto-untested)
 ** https://github.com/Linaro/odp/pull/379
 ** Patch: https://github.com/Linaro/odp/pull/379.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 36b032fa07bb9b29a0c8f774c2ce76da96b4d653
 **/
 test/validation/api/crypto/odp_crypto_test_inp.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c
index ddbad3097..8d1489ae6 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -437,6 +437,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);
@@ -555,21 +557,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);
 }
 
 /**