From da0af48a67a545840be2d1ba4219f6236db0b1f5 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Thu, 11 Jan 2018 17:50:34 +0000 Subject: [PATCH] test: add skipped return result 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 Signed-off-by: Harry van Haaren Acked-by: Pablo de Lara --- 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 6649cfc321..0473dac6ca 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 5198330ccc..4540fb8064 100644 --- a/test/test/test.h +++ b/test/test/test.h @@ -12,8 +12,9 @@ #include #include -#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.20.1