From patchwork Wed Jun 20 12:14:44 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: 932152 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="f6yIBB8o"; 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 419kSL0KD4z9sB4; 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-0003z6-PH; Wed, 20 Jun 2018 12:20:27 +0000 Received: from mo4-p03-ob.smtp.rzone.de ([81.169.146.175]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1fVc12-0003Tg-GS 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=1529496912; 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=/ICTEFND0Lclb0oY3ycfVmwuwNL5x0B/HcwbjgoFy9M=; b=f6yIBB8oUU11Y8eM6EK76td532+vm/9J+HLLaRGWE4HVCzF6nQTO2PvHl3dUp3tbY9 4nRfkcPHwIrHSFZlVM1QoSlwnIaiFMgqPAwqAPNmJLk2FDfHntOlGCbE2oU89nk+KOBj QZjK5/gReCYz2NnXZCvjbMzqROcxvKdGixNZ5CHDKHPRvFJnu/QfH9awpgUqPBRPqHWn WgSEaaXkMeHpP8LOw4SffK8yTQ8jEwJGou2U9PWlPhd0FvvIbyPAPIExOe1Fje3cJx76 KAFs7RyHwcx0m+8negwB95z6ArtVN6U2pM/uDH3Osme+dyJjZfVW35ldZpAC69YmlcZn AnKg== 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 Y09740u5KCFB155 (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 18/20] fwts_Framework: add clog argument Date: Wed, 20 Jun 2018 14:14:44 +0200 Message-Id: <20180620121446.31470-19-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" Add '--clog' argument to parse a coreboot logfile dump. Signed-off-by: Marcello Sylvester Bauer Acked-by: Colin Ian King Acked-by: Alex Hung --- src/coreboot/clog/clog.c | 2 +- src/lib/include/fwts_clog.h | 2 +- src/lib/include/fwts_framework.h | 1 + src/lib/src/fwts_clog.c | 13 +++++++------ src/lib/src/fwts_framework.c | 5 +++++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/coreboot/clog/clog.c b/src/coreboot/clog/clog.c index adb8aa83..caf0fecf 100644 --- a/src/coreboot/clog/clog.c +++ b/src/coreboot/clog/clog.c @@ -29,7 +29,7 @@ static fwts_list *clog; static int clog_init(fwts_framework *fw) { - clog = fwts_clog_read(); + clog = fwts_clog_read(fw); if (clog == NULL) { fwts_log_error(fw, "Cannot read coreboot log."); diff --git a/src/lib/include/fwts_clog.h b/src/lib/include/fwts_clog.h index 96b7557c..6f3bab6c 100644 --- a/src/lib/include/fwts_clog.h +++ b/src/lib/include/fwts_clog.h @@ -27,7 +27,7 @@ typedef void (*fwts_clog_progress_func)(fwts_framework *fw, int percent); typedef void (*fwts_clog_scan_func)(fwts_framework *fw, char *line, int repeated, char *prevline, void *private, int *errors); void fwts_clog_free(fwts_list *list); -fwts_list *fwts_clog_read(void); +fwts_list *fwts_clog_read(fwts_framework *fw); 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); diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h index 6c457be8..6c53b233 100644 --- a/src/lib/include/fwts_framework.h +++ b/src/lib/include/fwts_framework.h @@ -119,6 +119,7 @@ struct fwts_framework { char *lspci; /* path to lspci */ char *acpi_table_path; /* path to raw ACPI tables */ char *acpi_table_acpidump_file; /* path to ACPI dump file */ + char *clog; /* path to dump of coreboot log */ char *klog; /* path to dump of kernel log */ char *olog; /* path to OLOG */ char *json_data_path; /* path to application json data files, e.g. json klog data */ diff --git a/src/lib/src/fwts_clog.c b/src/lib/src/fwts_clog.c index 3257d55b..80576bd6 100644 --- a/src/lib/src/fwts_clog.c +++ b/src/lib/src/fwts_clog.c @@ -46,17 +46,18 @@ void fwts_clog_free(fwts_list *clog) /* * read coreboot log and return as list of lines - * TODO: 1) parse coreboot logfile as argument - * 2) find coreboot log in /dev/mem + * TODO: find coreboot log in /dev/mem */ -fwts_list *fwts_clog_read(void) +fwts_list *fwts_clog_read(fwts_framework *fw) { fwts_list *list; - if ((list = fwts_file_open_and_read(GOOGLE_MEMCONSOLE_COREBOOT_PATH)) == NULL) - return NULL; + if (fw->clog && (list = fwts_file_open_and_read(fw->clog))) + return list; + if ((list = fwts_file_open_and_read(GOOGLE_MEMCONSOLE_COREBOOT_PATH)) != NULL) + return list; - return list; + return NULL; } int fwts_clog_scan(fwts_framework *fw, diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 0aa0c047..f6e7b72e 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -135,6 +135,7 @@ static fwts_option fwts_framework_options[] = { { "arch", "", 1, "Specify arch of the tables being tested (defaults to current host)." }, { "sbbr", "", 0, "Run ARM SBBR tests." }, { "ifv", "", 0, "Run tests in firmware-vendor modes." }, + { "clog", "", 1, "Specify a coreboot logfile dump" }, { NULL, NULL, 0, NULL } }; @@ -1334,6 +1335,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar case 47: /* --ifv */ fw->flags |= FWTS_FLAG_FIRMWARE_VENDOR; break; + case 48: /* --coreboot-log */ + fwts_framework_strdup(&fw->clog, optarg); + } break; case 'a': /* --all */ @@ -1623,6 +1627,7 @@ tidy_close: free(fw->lspci); free(fw->results_logname); + free(fw->clog); free(fw->klog); free(fw->olog); free(fw->json_data_path);