* [PATCH] test/crypto: return proper codes in create session
@ 2024-11-27 15:15 Rajesh Mudimadugula
0 siblings, 0 replies; only message in thread
From: Rajesh Mudimadugula @ 2024-11-27 15:15 UTC (permalink / raw)
To: dev; +Cc: gakhil, fanzhang.oss, Rajesh Mudimadugula
Return proper error codes in create_auth_session() to avoid
segfaults as a result of this.
Signed-off-by: Rajesh Mudimadugula <rmudimadugul@marvell.com>
---
app/test/test_cryptodev.c | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index c647baeee1..448ace3216 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13009,6 +13009,8 @@ test_cryptodev_error_recover_helper(uint8_t dev_id, const void *test_data, bool
ut_params->sess = rte_cryptodev_sym_session_create(dev_id, &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -14710,15 +14712,19 @@ test_multi_session(void)
sessions[i] = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
- if (sessions[i] == NULL && rte_errno == ENOTSUP) {
+ if (sessions[i] == NULL) {
nb_sess = i;
- ret = TEST_SKIPPED;
+ if (rte_errno == ENOTSUP)
+ ret = TEST_SKIPPED;
+ else {
+ ret = TEST_FAILED;
+ printf("TestCase %s() line %d failed : "
+ "Session creation failed at session number %u",
+ __func__, __LINE__, i);
+ }
break;
}
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
/* Attempt to send a request on each session */
ret = test_AES_CBC_HMAC_SHA512_decrypt_perform(
@@ -14846,15 +14852,19 @@ test_multi_session_random_usage(void)
ts_params->valid_devs[0],
&ut_paramz[i].ut_params.auth_xform,
ts_params->session_mpool);
- if (sessions[i] == NULL && rte_errno == ENOTSUP) {
+ if (sessions[i] == NULL) {
nb_sess = i;
- ret = TEST_SKIPPED;
+ if (rte_errno == ENOTSUP)
+ ret = TEST_SKIPPED;
+ else {
+ ret = TEST_FAILED;
+ printf("TestCase %s() line %d failed : "
+ "Session creation failed at session number %u",
+ __func__, __LINE__, i);
+ }
goto session_clear;
}
- TEST_ASSERT_NOT_NULL(sessions[i],
- "Session creation failed at session number %u",
- i);
}
nb_sess = i;
@@ -14937,6 +14947,8 @@ test_null_invalid_operation(void)
ut_params->sess = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0], &ut_params->cipher_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
@@ -14951,6 +14963,8 @@ test_null_invalid_operation(void)
ut_params->sess = rte_cryptodev_sym_session_create(
ts_params->valid_devs[0], &ut_params->auth_xform,
ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT(ut_params->sess == NULL,
"Session creation succeeded unexpectedly");
@@ -15098,6 +15112,8 @@ test_enqdeq_callback_null_cipher(void)
/* Create Crypto session */
ut_params->sess = rte_cryptodev_sym_session_create(ts_params->valid_devs[0],
&ut_params->auth_xform, ts_params->session_mpool);
+ if (ut_params->sess == NULL && rte_errno == ENOTSUP)
+ return TEST_SKIPPED;
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
@@ -16158,6 +16174,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
ts_params->session_mpool);
if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
@@ -16208,6 +16225,7 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
ts_params->session_mpool);
if (ut_params->sess == NULL && rte_errno == ENOTSUP)
return TEST_SKIPPED;
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
return 0;
}
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-27 15:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-27 15:15 [PATCH] test/crypto: return proper codes in create session Rajesh Mudimadugula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).