test/eventdev: fix incorrect unit test

Message ID 20180905142331.9167-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series test/eventdev: fix incorrect unit test |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pavan Nikhilesh Sept. 5, 2018, 2:23 p.m. UTC
  Enqueue, dequeue depths are only valid for event devs that have burst
mode capability. Check event dev capability before testing depth
boundary.

Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 test/test/test_eventdev.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
  

Comments

Jerin Jacob Sept. 23, 2018, 8:59 a.m. UTC | #1
-----Original Message-----
> Date: Wed,  5 Sep 2018 19:53:31 +0530
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com
> Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH] test/eventdev: fix incorrect unit test
> X-Mailer: git-send-email 2.18.0
> 
> Enqueue, dequeue depths are only valid for event devs that have burst
> mode capability. Check event dev capability before testing depth
> boundary.
> 
> Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")

Cc: stable@dpdk.org

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  test/test/test_eventdev.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
> index 04bdc6b6c..00d73275c 100644
> --- a/test/test/test_eventdev.c
> +++ b/test/test/test_eventdev.c
> @@ -190,15 +190,18 @@ test_eventdev_configure(void)
>  		 "Config negative test failed");
>  	TEST_ASSERT_EQUAL(-EINVAL,
>  		test_ethdev_config_run(&dev_conf, &info, max_event_queue_flows),
> -		 "Config negative test failed");
> -	TEST_ASSERT_EQUAL(-EINVAL,
> -		test_ethdev_config_run(&dev_conf, &info,
> -			max_event_port_dequeue_depth),
> -			 "Config negative test failed");
> -	TEST_ASSERT_EQUAL(-EINVAL,
> -		test_ethdev_config_run(&dev_conf, &info,
> -		max_event_port_enqueue_depth),
> -		 "Config negative test failed");
> +		"Config negative test failed");
> +
> +	if (info.event_dev_cap & RTE_EVENT_DEV_CAP_BURST_MODE) {
> +		TEST_ASSERT_EQUAL(-EINVAL,
> +				test_ethdev_config_run(&dev_conf, &info,
> +					max_event_port_dequeue_depth),
> +				"Config negative test failed");
> +		TEST_ASSERT_EQUAL(-EINVAL,
> +				test_ethdev_config_run(&dev_conf, &info,
> +					max_event_port_enqueue_depth),
> +				"Config negative test failed");
> +	}
>  
>  	/* Positive case */
>  	devconf_set_default_sane_values(&dev_conf, &info);
> -- 
> 2.18.0
>
  
Jerin Jacob Sept. 25, 2018, 3:35 a.m. UTC | #2
-----Original Message-----
> Date: Sun, 23 Sep 2018 14:29:07 +0530
> From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> To: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> CC: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] test/eventdev: fix incorrect unit test
> User-Agent: Mutt/1.10.1 (2018-07-13)
> 
> 
> -----Original Message-----
> > Date: Wed,  5 Sep 2018 19:53:31 +0530
> > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > To: jerin.jacob@caviumnetworks.com
> > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH] test/eventdev: fix incorrect unit test
> > X-Mailer: git-send-email 2.18.0
> >
> > Enqueue, dequeue depths are only valid for event devs that have burst
> > mode capability. Check event dev capability before testing depth
> > boundary.
> >
> > Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")
> 
> Cc: stable@dpdk.org
> 
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Applied to dpdk-next-eventdev/master. Thanks.
  

Patch

diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 04bdc6b6c..00d73275c 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -190,15 +190,18 @@  test_eventdev_configure(void)
 		 "Config negative test failed");
 	TEST_ASSERT_EQUAL(-EINVAL,
 		test_ethdev_config_run(&dev_conf, &info, max_event_queue_flows),
-		 "Config negative test failed");
-	TEST_ASSERT_EQUAL(-EINVAL,
-		test_ethdev_config_run(&dev_conf, &info,
-			max_event_port_dequeue_depth),
-			 "Config negative test failed");
-	TEST_ASSERT_EQUAL(-EINVAL,
-		test_ethdev_config_run(&dev_conf, &info,
-		max_event_port_enqueue_depth),
-		 "Config negative test failed");
+		"Config negative test failed");
+
+	if (info.event_dev_cap & RTE_EVENT_DEV_CAP_BURST_MODE) {
+		TEST_ASSERT_EQUAL(-EINVAL,
+				test_ethdev_config_run(&dev_conf, &info,
+					max_event_port_dequeue_depth),
+				"Config negative test failed");
+		TEST_ASSERT_EQUAL(-EINVAL,
+				test_ethdev_config_run(&dev_conf, &info,
+					max_event_port_enqueue_depth),
+				"Config negative test failed");
+	}
 
 	/* Positive case */
 	devconf_set_default_sane_values(&dev_conf, &info);