diff mbox

[v2,1/2] vsp-lib: Capture the kernel log messages in test log files

Message ID 20180521091102.18764-2-laurent.pinchart@ideasonboard.com (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Laurent Pinchart May 21, 2018, 9:11 a.m. UTC
It can be useful to capture kernel log messages in test log files for
diagnostic purpose. Add a simple mechanism to do so by capturing the
full kernel log at the end of the test. The kernel log is cleared first
before starting the test to avoid capturing unrelated messages.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v1:

- Don't clear the kernel log
---
 scripts/vsp-lib.sh | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh
index 0f3992a7827e..0ecdf9acb152 100755
--- a/scripts/vsp-lib.sh
+++ b/scripts/vsp-lib.sh
@@ -1080,12 +1080,18 @@  test_init() {
 test_start() {
 	echo "Testing $1" | ./logger.sh >> $logfile
 	echo -n "Testing $1: " >&2
+
+	# Store the marker for the last line of the kernel log.
+	marker=$(dmesg | tail -n 1 | sed 's/^\[\([^]]*\)\].*/\1/g')
 }
 
 test_complete() {
 	echo "Done: $1" | ./logger.sh >> $logfile
 	echo $1 >&2
 
+	# Capture the part of the kernel log relative to the test.
+	dmesg | sed "1,/$marker/d" | ./logger.sh kernel >> $logfile
+
 	rm -f ${frames_dir}frame-*.bin
 	rm -f ${frames_dir}histo-*.bin
 	rm -f ${frames_dir}rpf.*.bin