From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06AD845DB7; Wed, 27 Nov 2024 16:15:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96E03402AB; Wed, 27 Nov 2024 16:15:20 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id B25354025D for ; Wed, 27 Nov 2024 16:15:18 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ARCTe4j030969; Wed, 27 Nov 2024 07:15:18 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=oydOsdDnAhgnjMgClxiB8o2 glpuJv7nvjXsZKIr6Z+8=; b=TklhC1M+yNx33srssBilu3YMhnqtSDgIJZXgP1p lDBBdkIN8R5WOzOa68x725TsOlh2H6duf3Vo7D7ZtnGdDnb0V9P7ne7Aq54M5bb8 fexU8X0+0q51qDOUCOjsdk+xXvUxp7ieYbak5IkM0gVfr/lQNhg1P88M9J8CW4Tt +IqHjCeR6wACjTLtUTLKNuOP2QbtnMVRJW1hgx6vlNj+U37P1+XWdH7jlt2EyUUK tFogHRrfTYbuace/d391e6Tq6CewOb7LeThSrKWS6D4pQmotYF6qYv17NTLlV1xm xKvNtTsYA/jlfTtfrzNl7Xk0j8QsVibmFt9gspJYmUhYGLQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4362u50d3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 07:15:16 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 27 Nov 2024 07:15:16 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 27 Nov 2024 07:15:16 -0800 Received: from transport-1.marvell.com (unknown [10.106.48.36]) by maili.marvell.com (Postfix) with ESMTP id F26753F706D; Wed, 27 Nov 2024 07:15:15 -0800 (PST) From: Rajesh Mudimadugula To: CC: , , Rajesh Mudimadugula Subject: [PATCH] test/crypto: return proper codes in create session Date: Wed, 27 Nov 2024 15:15:10 +0000 Message-ID: <20241127151510.1080129-1-rmudimadugul@marvell.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: xjDhtxGTbIE4tY-60n9KRZJAFkXNRS-B X-Proofpoint-GUID: xjDhtxGTbIE4tY-60n9KRZJAFkXNRS-B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Return proper error codes in create_auth_session() to avoid segfaults as a result of this. Signed-off-by: Rajesh Mudimadugula --- 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