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 4BAE245F2A; Tue, 24 Dec 2024 08:38:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6A384064A; Tue, 24 Dec 2024 08:37:59 +0100 (CET) Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 5108D40649 for ; Tue, 24 Dec 2024 08:37:58 +0100 (CET) Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BO5us8Y024463; Mon, 23 Dec 2024 23:37:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=a NA4jNOoyMh+nK5rfpsc9/JDNOtl0YOHXuW8m4LmTbw=; b=XwX+AUxVUX+JWFNI5 3lLStJ+jk8pzb2DTFyegE8J/Wp4EuABOW2amk4YwJx2no4/EWgX2vyM9KF4QsKEl WJgj7L6CAzumsy/lGYZo8WbzgMAsWMZVrQCZEdKe6YuTsl0Xg+ExRmytXdpCVx40 SJQxKYoXCyZ/IiK0QFFUG7p1GIZ8KQTq7M+4e+c7JY3tehpjUujKb+/qOtTSJO7S EDR808OSNvMSD9oVNd5jG/C0MKU5enefiqVQ42qwMCo7DU24BegAjHrJiIDDlDit U6gMLLupb8Dpnko4wQ9/YN4VhPlypJQZRI8jWp8kd08Lu/ke+1p2hnbaKs6ze288 LFtiA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 43qq83r8f8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 23:37:57 -0800 (PST) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 23 Dec 2024 23:37:56 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 23 Dec 2024 23:37:56 -0800 Received: from IN-lckQE5Rwctls.marvell.com (IN-lckQE5Rwctls.marvell.com [10.28.163.68]) by maili.marvell.com (Postfix) with ESMTP id B551A3F705D; Mon, 23 Dec 2024 23:37:53 -0800 (PST) From: Gowrishankar Muthukrishnan To: , Akhil Goyal , Maxime Coquelin , Chenbo Xia , Fan Zhang , Jay Zhou CC: , , Rajesh Mudimadugula Subject: [v1 05/16] test/crypto: return proper codes in create session Date: Tue, 24 Dec 2024 13:07:03 +0530 Message-ID: <7a0e0f7c73aa7a7fbb3fb82d4835daf92dd2495f.1735025264.git.gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 92A7zKIWOyeDr5reEib3ytP9sRID6o6k X-Proofpoint-ORIG-GUID: 92A7zKIWOyeDr5reEib3ytP9sRID6o6k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_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 From: Rajesh Mudimadugula 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 a33ef574cc..7cddb1517c 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -13006,6 +13006,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); @@ -14707,15 +14709,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( @@ -14843,15 +14849,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; @@ -14934,6 +14944,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"); @@ -14948,6 +14960,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"); @@ -15095,6 +15109,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); @@ -16155,6 +16171,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; } @@ -16205,6 +16222,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.25.1