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