test/pdcp: remove side affect from assertion

Message ID 20230619090403.3420173-1-vfialko@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series test/pdcp: remove side affect from assertion |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Volodymyr Fialko June 19, 2023, 9:04 a.m. UTC
  Remove side affect from test assertion, to avoid different behaviour in
non-debug build. Issues reported by coverity scan.

Coverity issue: 385419, 385420
Fixes: 6f00462979ad ("test/pdcp: add timer expiry cases")

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 app/test/test_pdcp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Anoob Joseph June 19, 2023, 10:21 a.m. UTC | #1
> 
> Remove side affect from test assertion, to avoid different behaviour in non-
> debug build. Issues reported by coverity scan.
> 
> Coverity issue: 385419, 385420
> Fixes: 6f00462979ad ("test/pdcp: add timer expiry cases")
> 
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>

Acked-by: Anoob Joseph <anoobj@marvell.com>
  
Akhil Goyal June 20, 2023, 1:29 p.m. UTC | #2
> > Remove side affect from test assertion, to avoid different behaviour in non-
> > debug build. Issues reported by coverity scan.
> >
> > Coverity issue: 385419, 385420
> > Fixes: 6f00462979ad ("test/pdcp: add timer expiry cases")
> >
> > Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
> 
> Acked-by: Anoob Joseph <anoobj@marvell.com>
> 
affect ->effect

Applied to dpdk-next-crypto
Thanks.
  

Patch

diff --git a/app/test/test_pdcp.c b/app/test/test_pdcp.c
index 423526380f..6c73c1db36 100644
--- a/app/test/test_pdcp.c
+++ b/app/test/test_pdcp.c
@@ -1338,8 +1338,9 @@  test_expiry_with_event_timer(const struct pdcp_test_conf *ul_conf)
 	while (n != 1) {
 		rte_delay_us(testsuite_params.min_resolution_ns / 1000);
 		n = rte_event_dequeue_burst(testsuite_params.evdev, TEST_EV_PORT_ID, &event, 1, 0);
-		ASSERT_TRUE_OR_GOTO(nb_try-- > 0, exit,
+		ASSERT_TRUE_OR_GOTO(nb_try > 0, exit,
 				"Dequeued unexpected timer expiry event: %i\n", n);
+		nb_try--;
 	}
 
 	ASSERT_TRUE_OR_GOTO(event.event_type == RTE_EVENT_TYPE_TIMER, exit, "Unexpected event type\n");
@@ -1433,8 +1434,9 @@  test_expiry_with_rte_timer(const struct pdcp_test_conf *ul_conf)
 	while (timer_args.status != 1) {
 		rte_delay_us(1);
 		rte_timer_manage();
-		ASSERT_TRUE_OR_GOTO(nb_try-- > 0, exit, "Bad expire handle status %i\n",
+		ASSERT_TRUE_OR_GOTO(nb_try > 0, exit, "Bad expire handle status %i\n",
 			timer_args.status);
+		nb_try--;
 	}
 
 	ret = TEST_SUCCESS;