From: Rajesh Mudimadugula <rmudimadugul@marvell.com>
To: <dev@dpdk.org>
Cc: <gakhil@marvell.com>, <fanzhang.oss@gmail.com>,
Rajesh Mudimadugula <rmudimadugul@marvell.com>
Subject: [PATCH] test/crypto: return proper codes in create session
Date: Wed, 27 Nov 2024 15:15:10 +0000 [thread overview]
Message-ID: <20241127151510.1080129-1-rmudimadugul@marvell.com> (raw)
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
reply other threads:[~2024-11-27 15:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241127151510.1080129-1-rmudimadugul@marvell.com \
--to=rmudimadugul@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).