From patchwork Thu Dec 6 18:11:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 204293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 347182C00DC for ; Fri, 7 Dec 2012 05:11:29 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tgfux-0002RJ-It; Thu, 06 Dec 2012 18:11:27 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tgfuu-0002Q3-9Z for fwts-devel@lists.ubuntu.com; Thu, 06 Dec 2012 18:11:24 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([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 1Tgfuu-0003xc-1a for fwts-devel@lists.ubuntu.com; Thu, 06 Dec 2012 18:11:24 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] lib, tests: remove fwts common test, merge into fwts klog Date: Thu, 6 Dec 2012 18:11:23 +0000 Message-Id: <1354817483-19934-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King The fwts common test is really a tiny subset of the klog test. It was included from the historical Linux firmware developers kit but now makes no sense to keep on its own. This patch removes the common helper code from fwts_klog.c and from the s3 and s4 tests. The common test data in klog.json is now merged with the klog firmware patterns and the fwts common tests is removed. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- data/klog.json | 7 +--- src/Makefile.am | 1 - src/acpi/common/common.c | 90 --------------------------------------------- src/acpi/s3/s3.c | 4 -- src/acpi/s4/s4.c | 4 -- src/lib/include/fwts_klog.h | 1 - src/lib/src/fwts_klog.c | 7 ---- 7 files changed, 2 insertions(+), 112 deletions(-) delete mode 100644 src/acpi/common/common.c diff --git a/data/klog.json b/data/klog.json index bf6a2f5..a6a7382 100644 --- a/data/klog.json +++ b/data/klog.json @@ -1,5 +1,5 @@ { - "common_error_warning_patterns": + "firmware_error_warning_patterns": [ { "compare_mode": "string", @@ -72,10 +72,7 @@ "pattern": "Disabling IRQ", "advice": "The kernel detected an irq storm. This is most probably an IRQ routing bug.", "label": "CommonBiosIrqRoutingBug" - } - ], - "firmware_error_warning_patterns": - [ + }, { "compare_mode": "regex", "log_level": "LOG_LEVEL_MEDIUM", diff --git a/src/Makefile.am b/src/Makefile.am index 478c522..116b62f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,7 +24,6 @@ fwts_SOURCES = main.c \ acpi/battery/battery.c \ acpi/brightness/brightness.c \ acpi/checksum/checksum.c \ - acpi/common/common.c \ acpi/cstates/cstates.c \ acpi/dmar/dmar.c \ acpi/fadt/fadt.c \ diff --git a/src/acpi/common/common.c b/src/acpi/common/common.c deleted file mode 100644 index b4d7c57..0000000 --- a/src/acpi/common/common.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2006, Intel Corporation - * Copyright (C) 2010-2012 Canonical - * - * This file was originally part of the Linux-ready Firmware Developer Kit - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ -#include "fwts.h" - -#ifdef FWTS_ARCH_INTEL - -#include -#include -#include -#include -#include -#include - -static fwts_list *klog; - -static int dmesg_common_init(fwts_framework *fw) -{ - if (fw->klog) - klog = fwts_file_open_and_read(fw->klog); - else - klog = fwts_klog_read(); - - if (klog == NULL) { - fwts_log_error(fw, "cannot read kernel log"); - return FWTS_ERROR; - } - return FWTS_OK; -} - -static int dmesg_common_deinit(fwts_framework *fw) -{ - FWTS_UNUSED(fw); - - fwts_klog_free(klog); - - return FWTS_OK; -} - -static int dmesg_common_test1(fwts_framework *fw) -{ - int errors = 0; - - if (fwts_klog_common_check(fw, NULL, klog, &errors)) { - fwts_log_error(fw, "failed to scan kernel log"); - return FWTS_ERROR; - } - - if (errors > 0) - /* Already logged these errors if found */ - fwts_log_info(fw, "Found %d errors in kernel log", errors); - else - fwts_passed(fw, "No common error messages found in kernel message log."); - - return FWTS_OK; -} - -static fwts_framework_minor_test dmesg_common_tests[] = { - { dmesg_common_test1, "Check common errors in kernel log." }, - { NULL, NULL }, -}; - -static fwts_framework_ops dmesg_common_ops = { - .description = "General dmesg common errors check.", - .init = dmesg_common_init, - .deinit = dmesg_common_deinit, - .minor_tests = dmesg_common_tests -}; - -FWTS_REGISTER(dmesg_common, &dmesg_common_ops, FWTS_TEST_EARLY, FWTS_FLAG_BATCH); - -#endif diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c index c651cfd..a1b7848 100644 --- a/src/acpi/s3/s3.c +++ b/src/acpi/s3/s3.c @@ -208,10 +208,6 @@ static int s3_check_log(fwts_framework *fw, int *errors, int *oopses, int *warn_ fwts_log_error(fw, "Error parsing kernel log."); *errors += error; - if (fwts_klog_common_check(fw, NULL, klog, &error)) - fwts_log_error(fw, "Error parsing kernel log."); - *errors += error; - if (fwts_oops_check(fw, klog, &oops, &warn_on)) fwts_log_error(fw, "Error parsing kernel log."); diff --git a/src/acpi/s4/s4.c b/src/acpi/s4/s4.c index 1306582..728062d 100644 --- a/src/acpi/s4/s4.c +++ b/src/acpi/s4/s4.c @@ -84,10 +84,6 @@ static void s4_check_log(fwts_framework *fw, fwts_log_error(fw, "Error parsing kernel log."); *errors += error; - if (fwts_klog_common_check(fw, NULL, klog, &error)) - fwts_log_error(fw, "Error parsing kernel log."); - *errors += error; - if (fwts_oops_check(fw, klog, &oops, &warn_on)) fwts_log_error(fw, "Error parsing kernel log."); *oopses += oops; diff --git a/src/lib/include/fwts_klog.h b/src/lib/include/fwts_klog.h index db3b65b..640455b 100644 --- a/src/lib/include/fwts_klog.h +++ b/src/lib/include/fwts_klog.h @@ -60,7 +60,6 @@ int fwts_klog_clear(void); int fwts_klog_firmware_check(fwts_framework *fw, fwts_klog_progress_func progress, fwts_list *klog, int *errors); int fwts_klog_pm_check(fwts_framework *fw, fwts_klog_progress_func progress, fwts_list *klog, int *errors); -int fwts_klog_common_check(fwts_framework *fw, fwts_klog_progress_func progress, fwts_list *klog, int *errors); int fwts_klog_regex_find(fwts_framework *fw, fwts_list *klog, char *pattern); char *fwts_klog_remove_timestamp(char *text); diff --git a/src/lib/src/fwts_klog.c b/src/lib/src/fwts_klog.c index 7d75b6d..b3ba9ee 100644 --- a/src/lib/src/fwts_klog.c +++ b/src/lib/src/fwts_klog.c @@ -448,13 +448,6 @@ int fwts_klog_pm_check(fwts_framework *fw, fwts_klog_progress_func progress, progress, klog, errors); } -int fwts_klog_common_check(fwts_framework *fw, fwts_klog_progress_func progress, - fwts_list *klog, int *errors) -{ - return fwts_klog_check(fw, "common_error_warning_patterns", - progress, klog, errors); -} - static void fwts_klog_regex_find_callback(fwts_framework *fw, char *line, int repeated, char *prev, void *pattern, int *match) {