[PATCH] lib, tests: remove fwts common test, merge into fwts klog

Keng-Yu Lin kengyu at canonical.com
Mon Dec 10 07:09:48 UTC 2012


On Fri, Dec 7, 2012 at 2:11 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> 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 <colin.king at canonical.com>
> ---
>  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 <stdlib.h>
> -#include <stdio.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <unistd.h>
> -#include <string.h>
> -
> -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)
>  {
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list