[v2,1/3] test/dma: add test skip status

Message ID 20230810123633.2455-2-gmuthukrishn@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series test/dma: add vchan reconfig and SG tests |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gowrishankar Muthukrishnan Aug. 10, 2023, 12:36 p.m. UTC
  Add status on skipped tests.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 app/test/test_dmadev_api.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
  

Patch

diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
index 4a181af90a..a1646472b0 100644
--- a/app/test/test_dmadev_api.c
+++ b/app/test/test_dmadev_api.c
@@ -9,6 +9,8 @@ 
 #include <rte_test.h>
 #include <rte_dmadev.h>
 
+#include "test.h"
+
 extern int test_dma_api(uint16_t dev_id);
 
 #define DMA_TEST_API_RUN(test) \
@@ -17,9 +19,6 @@  extern int test_dma_api(uint16_t dev_id);
 #define TEST_MEMCPY_SIZE	1024
 #define TEST_WAIT_US_VAL	50000
 
-#define TEST_SUCCESS 0
-#define TEST_FAILED  -1
-
 static int16_t test_dev_id;
 static int16_t invalid_dev_id;
 
@@ -29,6 +28,7 @@  static char *dst;
 static int total;
 static int passed;
 static int failed;
+static int skipped;
 
 static int
 testsuite_setup(int16_t dev_id)
@@ -49,6 +49,7 @@  testsuite_setup(int16_t dev_id)
 	total = 0;
 	passed = 0;
 	failed = 0;
+	skipped = 0;
 
 	/* Set dmadev log level to critical to suppress unnecessary output
 	 * during API tests.
@@ -78,12 +79,22 @@  testsuite_run_test(int (*test)(void), const char *name)
 
 	if (test) {
 		ret = test();
-		if (ret < 0) {
-			failed++;
-			printf("%s Failed\n", name);
-		} else {
+		switch (ret) {
+		case TEST_SUCCESS:
 			passed++;
 			printf("%s Passed\n", name);
+			break;
+		case TEST_FAILED:
+			failed++;
+			printf("%s Failed\n", name);
+			break;
+		case TEST_SKIPPED:
+			skipped++;
+			printf("%s Skipped\n", name);
+			break;
+		default:
+			printf("Invalid test status\n");
+			break;
 		}
 	}
 
@@ -566,6 +577,7 @@  test_dma_api(uint16_t dev_id)
 	printf("Total tests   : %d\n", total);
 	printf("Passed        : %d\n", passed);
 	printf("Failed        : %d\n", failed);
+	printf("Skipped       : %d\n", skipped);
 
 	if (failed)
 		return -1;