From 26438aa34ca8018b7d2d1832a8c7600511394e97 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Wed, 28 Feb 2018 12:26:35 +0000 Subject: [PATCH] CI: Add call to log parser Call the log parser at the end of the test run. It will check all component log files and display a detailed error message if any issues are found. Signed-off-by: James O. D. Hunt --- .ci/run.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.ci/run.sh b/.ci/run.sh index 2fabd2e511..6338c8d630 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -9,6 +9,39 @@ set -e +check_log_files() +{ + make log-parser + + # XXX: Only the CC runtime uses structured logging, + # XXX: hence specify by name (rather than using $RUNTIME). + for component in \ + kata-proxy \ + kata-runtime-cc \ + kata-shim + do + file="${component}.log" + args="--no-pager -q -o cat -a -t \"${component}\"" + + cmd="sudo journalctl ${args} > ${file}" + eval "$cmd" + done + + logs=$(ls "$(pwd)"/*.log) + { kata-log-parser --debug --check-only --error-if-no-records $logs; ret=$?; } || true + + # Always remove logs since: + # + # - We don't want to waste disk-space. + # - The teardown script will save the full logs anyway. + # - the log parser tool shows full details of what went wrong. + rm -f $logs + + [ $ret -eq 0 ] && true || false +} + export RUNTIME="kata-runtime" sudo -E PATH="$PATH" bash -c "make check" + +check_log_files