From 1ced44298358445b9a9cb0cc44ca40a97296240c Mon Sep 17 00:00:00 2001 From: Mateusz Majewski Date: Mon, 3 Feb 2020 15:43:10 +0100 Subject: [PATCH] Add KMSG integration test Change-Id: Id41b5091cc7a9cfa6a74a712e01310e80fcce958 --- tests/dlog_test.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/dlog_test.in b/tests/dlog_test.in index 43bb832..0b9994e 100644 --- a/tests/dlog_test.in +++ b/tests/dlog_test.in @@ -444,6 +444,17 @@ dlogsend -b main -t DLOG_TESTSUITE rawformatTEST line=`$cmd_prefix $format | $cmd_postfix` [[ "$line" == "rawformatTEST" ]] && ok || fail +LOG_DETAILS="testing if KMSG works in the default format" +# We check if the command returns at least 1000 logs. This seems to be a safe value. In my test, +# my target reaches it in about 2 seconds after the boot. Feel free to change it to a reasonable +# yet lower value if the test happens to fail otherwise, but it would be extremely surprising. +[[ "$(dlogutil -db kmsg | wc -l)" -gt 1000 ]] && ok || fail + +LOG_DETAILS="testing if KMSG works in the raw format" +last_dmesg=`dmesg | tail -n1 | sed -re "s/^\[[ 0-9]{5,}\.[0-9]{6}\] (.*)$/\1/g"` +sleep 1 # To make sure dlog has already parsed the log +dlogutil -db kmsg -v raw | grep -Fm1 "$last_dmesg" >/dev/null && ok || fail + LOG_DETAILS="testing if pid filtering works" dlogsend -b main -t DLOG_TESTSUITE pidTEST & sleep 1 -- 2.7.4