[isar-cip-core][PATCH v3 2/6] Add dmesg filter needed for lava test result

Jan Kiszka
2022-01-27T17:13:00Z

From: Alice Ferrazzi <alice.ferrazzi@miraclelinux.com>

KernelCI is using a dmesg filter script for checking dmesg
logs result with lava.
Adding the script to the cip-core-image-kernelci.

Signed-off-by: Alice Ferrazzi <alice.ferrazzi@miraclelinux.com>
[Jan: restore actual installation]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../kernelci-customizations/files/dmesg.sh | 23 +++++++++++++++++++
.../kernelci-customizations.bb | 4 ++++
2 files changed, 27 insertions(+)
create mode 100644 recipes-core/kernelci-customizations/files/dmesg.sh

diff --git a/recipes-core/kernelci-customizations/files/dmesg.sh b/recipes-core/kernelci-customizations/files/dmesg.sh
new file mode 100644
index 0000000..3b096e1
--- /dev/null
+++ b/recipes-core/kernelci-customizations/files/dmesg.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+if [ "$KERNELCI_LAVA" = "y" ]; then
+ alias test-result='lava-test-case'
+else
+ alias test-result='echo'
+fi
+
+for level in crit alert emerg; do
+ dmesg --level=$level --notime -x -k > dmesg.$level
+ test -s dmesg.$level && res=fail || res=pass
+ count=$(cat dmesg.$level | wc -l)
+ cat dmesg.$level
+ test-result \
+ $level \
+ --result $res \
+ --measurement $count \
+ --units lines
+done
+
+exit 0
diff --git a/recipes-core/kernelci-customizations/kernelci-customizations.bb b/recipes-core/kernelci-customizations/kernelci-customizations.bb
index dca0891..df4257c 100644
--- a/recipes-core/kernelci-customizations/kernelci-customizations.bb
+++ b/recipes-core/kernelci-customizations/kernelci-customizations.bb
@@ -18,6 +18,7 @@ DESCRIPTION = "CIP Core image demo & customizations"
SRC_URI = " \
file://postinst \
file://ethernet \
+ file://dmesg.sh \
file://99-silent-printk.conf"

DEPENDS += "sshd-regen-keys"
@@ -31,4 +32,7 @@ do_install() {

install -v -d ${D}/etc/sysctl.d
install -v -m 644 ${WORKDIR}/99-silent-printk.conf ${D}/etc/sysctl.d/
+
+ install -v -d ${D}/opt/kernelci
+ install -v -m 744 ${WORKDIR}/dmesg.sh ${D}/opt/kernelci/
}
--
2.31.1