test: add skipped return result
authorHarry van Haaren <harry.van.haaren@intel.com>
Thu, 11 Jan 2018 17:50:34 +0000 (17:50 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 17 Jan 2018 23:06:56 +0000 (00:06 +0100)
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@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
test/test/commands.c
test/test/test.h

index 6649cfc..0473dac 100644 (file)
@@ -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);
index 5198330..4540fb8 100644 (file)
@@ -12,8 +12,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