]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Introduce 'skip' as a test result
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Jan 2016 12:48:07 +0000 (12:48 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Jan 2016 12:48:07 +0000 (12:48 +0000)
There are situations where the test cannot be completed, and this might be
considered success or failure, depending on the exact outcome intended by the
individual who is running the tests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
common/report.c
include/xtf/report.h

index f043bd60e4d2311869280353d25c7aaf70130f89..9351c206ed6e243b730e73f2047e52b9287e6ab8 100644 (file)
@@ -5,6 +5,7 @@
 enum test_status {
     STATUS_RUNNING, /**< Test not yet completed.       */
     STATUS_SUCCESS, /**< Test was successful.          */
+    STATUS_SKIP,    /**< Test cannot be completed.     */
     STATUS_ERROR,   /**< Issue with the test itself.   */
     STATUS_FAILURE, /**< Issue with the tested matter. */
 };
@@ -12,7 +13,7 @@ enum test_status {
 /** Current status of this test. */
 static enum test_status status;
 
-/** Whether a warning has occured. */
+/** Whether a warning has occurred. */
 static bool warnings;
 
 static const char *status_to_str[] =
@@ -21,6 +22,7 @@ static const char *status_to_str[] =
 
     STA(RUNNING),
     STA(SUCCESS),
+    STA(SKIP),
     STA(ERROR),
     STA(FAILURE),
 
@@ -49,6 +51,17 @@ void xtf_warning(const char *fmt, ...)
     va_end(args);
 }
 
+void xtf_skip(const char *fmt, ...)
+{
+    va_list args;
+
+    set_status(STATUS_SKIP);
+
+    va_start(args, fmt);
+    vprintk(fmt, args);
+    va_end(args);
+}
+
 void xtf_error(const char *fmt, ...)
 {
     va_list args;
index 3b584c3630b37d5f1f513e15880d85fdf22c3154..14e63963e972ab732e4d0881a383385fcc5214fb 100644 (file)
  *
  * A test is expected to report one of:
  *  - Success
+ *  - Skip
  *  - Error
  *  - Failure
  *
- * 'Success' indicates that everything went well.  'Error' indicates a bug in
- * the test code or environment itself, while 'Failure' indicates a bug in the
- * code under test.
+ * 'Success' indicates that everything went well, while 'Skip' indicates that
+ * the test cannot be completed.  'Error' indicates a bug in the test code or
+ * environment itself, while 'Failure' indicates a bug in the code under test.
  *
  * If multiple statuses are reported, the most severe is the one which is
  * kept.
@@ -35,6 +36,14 @@ void xtf_success(void);
  */
 void xtf_warning(const char *fmt, ...) __printf(1, 2);
 
+/**
+ * Report a test skip.
+ *
+ * Indicates that the test cannot be completed.  This may count as a success
+ * or failure, depending on the opinion of the tester.
+ */
+void xtf_skip(const char *fmt, ...) __printf(1, 2);
+
 /**
  * Report a test error.
  *