From 6e85a01e4be8ee85b20f0eeef478bededba61959 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Fri, 15 Jan 2016 12:48:07 +0000 Subject: [PATCH] Introduce 'skip' as a test result 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 --- common/report.c | 15 ++++++++++++++- include/xtf/report.h | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/common/report.c b/common/report.c index f043bd6..9351c20 100644 --- a/common/report.c +++ b/common/report.c @@ -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; diff --git a/include/xtf/report.h b/include/xtf/report.h index 3b584c3..14e6396 100644 --- a/include/xtf/report.h +++ b/include/xtf/report.h @@ -11,12 +11,13 @@ * * 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. * -- 2.39.5