Add KMSG integration test 45/223745/3
authorMateusz Majewski <m.majewski2@samsung.com>
Mon, 3 Feb 2020 14:43:10 +0000 (15:43 +0100)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 5 Feb 2020 11:15:09 +0000 (11:15 +0000)
Change-Id: Id41b5091cc7a9cfa6a74a712e01310e80fcce958

tests/dlog_test.in

index 43bb832..0b9994e 100644 (file)
@@ -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