Message ID | 1390213757-16265-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 01/20/2014 06:29 PM, Colin King wrote: > From: Colin Ian King <colin.king@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@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)); > } > Acked-by: Alex Hung <alex.hung@canonical.com>
On 01/20/2014 06:29 PM, Colin King wrote: > From: Colin Ian King <colin.king@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@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)); > } > Acked-by: Ivan Hu <ivan.hu@canonical.com>
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)); }