[PATCH 16/20] fwts_clog: add fwts_clog_firmware_check
Marcello Sylvester Bauer
info at marcellobauer.com
Wed Jun 20 12:14:42 UTC 2018
Signed-off-by: Marcello Sylvester Bauer <info at marcellobauer.com>
---
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);
+}
--
2.16.4
More information about the fwts-devel
mailing list