[dpdk-dev] [PATCH v2 2/3] test: add skipped return result

Harry van Haaren harry.van.haaren at intel.com
Thu Jan 11 18:50:34 CET 2018


This commit allows a test to return "skipped", indicating
that it cannot be run. This is useful for PMDs which have
not been compiled due to the unavailability of dependencies,
or their explicit disabling in the build configuration.

The result printing is updated to correctly indicate if a
test has been skipped.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>

---

v2:
- Re-split patch into two, rewording titles check-git-log (Pablo)
- Add check for "Skipped" tests to not print "Failed" (Pablo)
---
 test/test/commands.c | 2 ++
 test/test/test.h     | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/test/test/commands.c b/test/test/commands.c
index 6649cfc..0473dac 100644
--- a/test/test/commands.c
+++ b/test/test/commands.c
@@ -106,6 +106,8 @@ static void cmd_autotest_parsed(void *parsed_result,
 	last_test_result = ret;
 	if (ret == 0)
 		printf("Test OK\n");
+	else if (ret == TEST_SKIPPED)
+		printf("Test Skipped\n");
 	else
 		printf("Test Failed\n");
 	fflush(stdout);
diff --git a/test/test/test.h b/test/test/test.h
index ae88a70..a8f765a 100644
--- a/test/test/test.h
+++ b/test/test/test.h
@@ -11,8 +11,9 @@
 #include <rte_common.h>
 #include <rte_log.h>
 
-#define TEST_SUCCESS  (0)
-#define TEST_FAILED  (-1)
+#define TEST_SUCCESS EXIT_SUCCESS
+#define TEST_FAILED  -1
+#define TEST_SKIPPED  77
 
 /* Before including test.h file you can define
  * TEST_TRACE_FAILURE(_file, _line, _func) macro to better trace/debug test
-- 
2.7.4



More information about the dev mailing list