From patchwork Mon Jan 20 10:29:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 312485 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id E9CA82C007C for ; Mon, 20 Jan 2014 21:29:26 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1W5C6c-0004ZO-Uu; Mon, 20 Jan 2014 10:29:22 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1W5C6X-0004ZE-Fx for fwts-devel@lists.ubuntu.com; Mon, 20 Jan 2014 10:29:17 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginm.net ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1W5C6X-00014w-DK for fwts-devel@lists.ubuntu.com; Mon, 20 Jan 2014 10:29:17 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] lib: fwts_framework: fix --stdout-summary output (LP: #1252186) Date: Mon, 20 Jan 2014 10:29:17 +0000 Message-Id: <1390213757-16265-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.5.3 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King 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 Acked-by: Alex Hung Acked-by: Ivan Hu --- 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)); }