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

Message ID 1515693035-35419-2-git-send-email-harry.van.haaren@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Van Haaren, Harry Jan. 11, 2018, 5:50 p.m. UTC
  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>

---

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(-)
  

Comments

De Lara Guarch, Pablo Jan. 11, 2018, 6:01 p.m. UTC | #1
> -----Original Message-----
> From: Van Haaren, Harry
> Sent: Thursday, January 11, 2018 5:51 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Richardson,
> Bruce <bruce.richardson@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>
> Subject: [PATCH v2 2/3] 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 <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>
  

Patch

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