[PATCH] lib: fwts_framework: fix --stdout-summary output (LP: #1252186)
Colin King
colin.king at canonical.com
Mon Jan 20 10:29:17 UTC 2014
From: Colin Ian King <colin.king at canonical.com>
The skipped test message was taking higher precedence than the
failure messages, meaning --stdout-summary was not reporting
errors if a sub test was skipping over a test. This means that
fwts was falsely reporting tests were OK even when critical errors
were being found.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_framework.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index 6f04c2c..1bf9424 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -428,11 +428,8 @@ static int fwts_framework_test_summary(fwts_framework *fw)
fwts_framework_underline(fw,'=');
if (fw->flags & FWTS_FLAG_STDOUT_SUMMARY) {
- if (results->aborted > 0)
- printf("%s\n", fwts_log_field_to_str_upper(LOG_ABORTED));
- else if (results->skipped > 0)
- printf("%s\n", fwts_log_field_to_str_upper(LOG_SKIPPED));
- else if (results->failed > 0) {
+ /* Report in order of failure precedence */
+ if (results->failed > 0) {
/* We intentionally report the highest logged error level */
if (fw->failed_level & LOG_LEVEL_CRITICAL)
printf("%s_CRITICAL\n", fwts_log_field_to_str_upper(LOG_FAILED));
@@ -443,9 +440,12 @@ static int fwts_framework_test_summary(fwts_framework *fw)
else if (fw->failed_level & LOG_LEVEL_LOW)
printf("%s_LOW\n", fwts_log_field_to_str_upper(LOG_FAILED));
else printf("%s\n", fwts_log_field_to_str_upper(LOG_FAILED));
- }
+ } else if (results->skipped > 0)
+ printf("%s\n", fwts_log_field_to_str_upper(LOG_SKIPPED));
else if (results->warning > 0)
printf("%s\n", fwts_log_field_to_str_upper(LOG_WARNING));
+ else if (results->aborted > 0)
+ printf("%s\n", fwts_log_field_to_str_upper(LOG_ABORTED));
else
printf("%s\n", fwts_log_field_to_str_upper(LOG_PASSED));
}
--
1.8.5.3
More information about the fwts-devel
mailing list