From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 882C3A0512 for ; Wed, 3 Jun 2020 15:17:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D14561D170; Wed, 3 Jun 2020 15:17:16 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id AA2AF1D170 for ; Wed, 3 Jun 2020 15:17:15 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 42C98200049; Wed, 3 Jun 2020 15:17:15 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 93DE0200E69; Wed, 3 Jun 2020 15:17:13 +0200 (CEST) Received: from lsv03186.swis.in-blr01.nxp.com (lsv03186.swis.in-blr01.nxp.com [92.120.146.182]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 4D153402B3; Wed, 3 Jun 2020 21:17:11 +0800 (SGT) From: Apeksha Gupta To: akhil.goyal@nxp.com Cc: apeksha.gupta@nxp.com, stable@dpdk.org Date: Wed, 3 Jun 2020 18:47:07 +0530 Message-Id: <20200603131707.10231-1-apeksha.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-stable] [PATCH 19.11] test/crypto: fix statistics case X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit 29fdc5bf4555e16e866188dd9fe95f9bab01404a ] The test case - test_stats is directly accessing the cryptodev and its dev_ops which are internal to library and should not be used directly by the application. However, the test case is also missing to check for the error ENOTSUP. It should skip the case if the API returns ENOTSUP. This patch fixes these two issues. Fixes: 202d375c60bc ("app/test: add cryptodev unit and performance tests") Cc: stable@dpdk.org Signed-off-by: Apeksha Gupta Acked-by: Akhil Goyal --- app/test/test_cryptodev.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 79ced809d..db9dd3aec 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -9158,8 +9158,10 @@ test_stats(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct rte_cryptodev_stats stats; - struct rte_cryptodev *dev; - cryptodev_stats_get_t temp_pfn; + + if (rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats) + == -ENOTSUP) + return -ENOTSUP; rte_cryptodev_stats_reset(ts_params->valid_devs[0]); TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0] + 600, @@ -9167,13 +9169,6 @@ test_stats(void) "rte_cryptodev_stats_get invalid dev failed"); TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], 0) != 0), "rte_cryptodev_stats_get invalid Param failed"); - dev = &rte_cryptodevs[ts_params->valid_devs[0]]; - temp_pfn = dev->dev_ops->stats_get; - dev->dev_ops->stats_get = (cryptodev_stats_get_t)0; - TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats) - == -ENOTSUP), - "rte_cryptodev_stats_get invalid Param failed"); - dev->dev_ops->stats_get = temp_pfn; /* Test expected values */ ut_setup(); -- 2.17.1