service: reintroduce test dummy service delay

Message ID 20241002193115.796610-1-mattias.ronnblom@ericsson.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series service: reintroduce test dummy service delay |

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/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS

Commit Message

Mattias Rönnblom Oct. 2, 2024, 7:31 p.m. UTC
Eliminate unreachable code and have dummy service function perform a
short delay again, mimicking previous service core test behavior.

Fixes: a37e053b2364 ("service: extend service function call statistics")

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 app/test/test_service_cores.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
  

Comments

David Marchand Oct. 3, 2024, 6:42 a.m. UTC | #1
On Wed, Oct 2, 2024 at 9:40 PM Mattias Rönnblom
<mattias.ronnblom@ericsson.com> wrote:
>
> Eliminate unreachable code and have dummy service function perform a
> short delay again, mimicking previous service core test behavior.
>
Coverity issue: 445158
> Fixes: a37e053b2364 ("service: extend service function call statistics")
>
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
index 7ae6bbb179..46ed9a1868 100644
--- a/app/test/test_service_cores.c
+++ b/app/test/test_service_cores.c
@@ -49,21 +49,27 @@  testsuite_teardown(void)
 static int32_t dummy_cb(void *args)
 {
 	RTE_SET_USED(args);
+	int32_t rc;
 
 	service_calls++;
 
 	switch (rte_rand_max(3)) {
 	case 0:
-		return 0;
+		rc = 0;
+		break;
 	case 1:
 		service_idle_calls++;
-		return -EAGAIN;
+		rc = -EAGAIN;
+		break;
 	default:
 		service_error_calls++;
-		return -ENOENT;
+		rc = -ENOENT;
+		break;
 	}
 
 	rte_delay_ms(SERVICE_DELAY);
+
+	return rc;
 }
 
 static int32_t dummy_mt_unsafe_cb(void *args)