ACK: [PATCH 18/20] fwts_Framework: add clog argument
Alex Hung
alex.hung at canonical.com
Wed Jun 27 23:02:11 UTC 2018
On 2018-06-20 05:14 AM, Marcello Sylvester Bauer wrote:
> Add '--clog' argument to parse a coreboot logfile dump.
>
> Signed-off-by: Marcello Sylvester Bauer <info at marcellobauer.com>
> ---
> 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);
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list