From patchwork Wed Jun 20 12:14:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcello Sylvester Bauer X-Patchwork-Id: 932156 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=marcellobauer.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=marcellobauer.com header.i=@marcellobauer.com header.b="rW8vmCfc"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 419kSL09xGz9s9y; Wed, 20 Jun 2018 22:20:33 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fVc67-0003yz-Mu; Wed, 20 Jun 2018 12:20:27 +0000 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.80]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1fVc12-0003TK-78 for fwts-devel@lists.ubuntu.com; Wed, 20 Jun 2018 12:15:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1529496911; s=strato-dkim-0002; d=marcellobauer.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=hgHJKDc8nAjr7T9/V67BMHVjr/0yHaSkUqsGeT9s7dQ=; b=rW8vmCfcJ8RCLKuHhoIpxe34Lke7S8G6XxUBLm4YX2t1Zw2ml+0dejZjox1+JSlP/z Fc2/zbNOkiPnsWGxIa0a0WFfxOll/Ve6RHS794Xz/bBSeotJ/dyCBiUgMriTtt/1LvfL 6PV8eLpzDTHRksQZlbXX2fAcnEFuGdckXxdnJnLE1xskoYkZfz2Chm+oy8fMvD9EXfjV 5ucLZQ1VF5Vp/VUZnEJAG4WQmwYLJd3l7m5aYL93kMjQwI/0+5PajZLZppVfDTW76VrV 3p4nrqZcixVBMM9neuJV4yROUtvzO1HF6l/5JIe6RrftmLM4ln0Ld5r3o/QzL4NSywM6 3poA== X-RZG-AUTH: ":P3kGVU2pafwxDWbfd7lCAWBxt4VwoTflSh0zGwV+MScAah+CJf7PfB0eiCQ3DUlp/Rnv8orA" X-RZG-CLASS-ID: mo00 Received: from W530.9e.network by smtp.strato.de (RZmta 43.10 DYNA|AUTH) with ESMTPSA id Y09740u5KCFB153 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 20 Jun 2018 14:15:11 +0200 (CEST) From: Marcello Sylvester Bauer To: fwts-devel@lists.ubuntu.com Subject: [PATCH 16/20] fwts_clog: add fwts_clog_firmware_check Date: Wed, 20 Jun 2018 14:14:42 +0200 Message-Id: <20180620121446.31470-17-info@marcellobauer.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180620121446.31470-1-info@marcellobauer.com> References: <20180620121446.31470-1-info@marcellobauer.com> X-Mailman-Approved-At: Wed, 20 Jun 2018 12:20:25 +0000 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcello Sylvester Bauer MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Signed-off-by: Marcello Sylvester Bauer Acked-by: Colin Ian King Acked-by: Alex Hung --- src/lib/include/fwts_clog.h | 1 + src/lib/src/fwts_clog.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/lib/include/fwts_clog.h b/src/lib/include/fwts_clog.h index 89cfc350..96b7557c 100644 --- a/src/lib/include/fwts_clog.h +++ b/src/lib/include/fwts_clog.h @@ -30,5 +30,6 @@ void fwts_clog_free(fwts_list *list); fwts_list *fwts_clog_read(void); int fwts_clog_scan(fwts_framework *fw, fwts_list *clog, fwts_clog_scan_func callback, fwts_clog_progress_func progress, void *private, int *errors); void fwts_clog_scan_patterns(fwts_framework *fw, char *line, int repeated, char *prevline, void *private, int *errors); +int fwts_clog_firmware_check(fwts_framework *fw, fwts_clog_progress_func progress, fwts_list *clog, int *errors); #endif diff --git a/src/lib/src/fwts_clog.c b/src/lib/src/fwts_clog.c index d5babb31..3257d55b 100644 --- a/src/lib/src/fwts_clog.c +++ b/src/lib/src/fwts_clog.c @@ -26,6 +26,16 @@ */ #define GOOGLE_MEMCONSOLE_COREBOOT_PATH "/sys/firmware/log" +/* + * clog pattern matching strings data file, data stored in json format + */ +#define CLOG_DATA_JSON_FILE "clog.json" + +/* + * match unique strings in the coreboot log +*/ +#define UNIQUE_CLOG_LABEL "Clog" + /* * free coreboot log list */ @@ -71,3 +81,23 @@ void fwts_clog_scan_patterns(fwts_framework *fw, "firmware test suite has no diagnostic advice for this particular problem."; fwts_log_scan_patterns(fw, line, repeated, prevline, private, errors, "coreboot", advice); } + +static int fwts_clog_check(fwts_framework *fw, + const char *table, + fwts_clog_progress_func progress, + fwts_list *clog, + int *errors) +{ + char json_data_path[PATH_MAX]; + + snprintf(json_data_path, sizeof(json_data_path), "%s/%s", fw->json_data_path, CLOG_DATA_JSON_FILE); + + return fwts_log_check(fw, table, fwts_clog_scan_patterns, progress, clog, errors, json_data_path, UNIQUE_CLOG_LABEL, true); +} + +int fwts_clog_firmware_check(fwts_framework *fw, fwts_clog_progress_func progress, + fwts_list *clog, int *errors) +{ + return fwts_clog_check(fw, "firmware_error_warning_patterns", + progress, clog, errors); +}