[v2] Test/crypto: check valid test_stats before running test

Message ID 20200515073242.24720-1-apeksha.gupta@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series [v2] Test/crypto: check valid test_stats before running test |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Apeksha Gupta May 15, 2020, 7:32 a.m. UTC
  Test_stats is an optional cryptodev op and if it is not defined by the
PMD, it should not run the test cases for it.

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
---
 app/test/test_cryptodev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Ruifeng Wang May 15, 2020, 7:42 a.m. UTC | #1
> -----Original Message-----
> From: Apeksha Gupta <apeksha.gupta@nxp.com>
> Sent: Friday, May 15, 2020 3:33 PM
> To: dev@dpdk.org
> Cc: Ruifeng Wang <Ruifeng.Wang@arm.com>; declan.doherty@intel.com;
> asomalap@amd.com; anoobj@marvell.com; roy.fan.zhang@intel.com;
> fiona.trahe@intel.com; rnagadheeraj@marvell.com; adwivedi@marvell.com;
> jianjay.zhou@huawei.com; pablo.de.lara.guarch@intel.com;
> adamx.dybkowski@intel.com; Akhil.goyal@nxp.com; Apeksha Gupta
> <apeksha.gupta@nxp.com>
> Subject: [PATCH v2] Test/crypto: check valid test_stats before running test
>
> Test_stats is an optional cryptodev op and if it is not defined by the PMD, it
> should not run the test cases for it.
>
> Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
> ---
>  app/test/test_cryptodev.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index
> c624018ee..1ad650675 100644
> --- a/app/test/test_cryptodev.c
> +++ b/app/test/test_cryptodev.c
> @@ -8801,6 +8801,10 @@ test_stats(void)
>  if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
>  return -ENOTSUP;
>
> +dev = &rte_cryptodevs[ts_params->valid_devs[0]];
> +if (dev->dev_ops->stats_get == 0)
> +return -ENOTSUP;
> +
>  /* Verify the capabilities */
>  struct rte_cryptodev_sym_capability_idx cap_idx;
>  cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; @@ -8820,7
> +8824,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)
> --
> 2.17.1
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
  

Patch

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index c624018ee..1ad650675 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -8801,6 +8801,10 @@  test_stats(void)
 	if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
 		return -ENOTSUP;
 
+	dev = &rte_cryptodevs[ts_params->valid_devs[0]];
+	if (dev->dev_ops->stats_get == 0)
+		return -ENOTSUP;
+
 	/* Verify the capabilities */
 	struct rte_cryptodev_sym_capability_idx cap_idx;
 	cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -8820,7 +8824,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)