diff --git a/test/main.sh b/test/main.sh index fdb5ad59123f..85994057e11c 100755 --- a/test/main.sh +++ b/test/main.sh @@ -94,9 +94,21 @@ cleanup() { if [ "${TEST_RESULT}" != "success" ]; then # dmesg may contain oops, IO errors, crashes, etc - echo "::group::dmesg logs" + # If there's a kernel stack trace, don't generate a collapsible group + + if journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --dmesg --grep "kernel: Call Trace:" > /dev/null; then + showDmesg=1 + fi + + if [ ! "${showDmesg}" ]; then + echo "::group::dmesg logs" + else + echo "dmesg logs" + fi journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --dmesg - echo "::endgroup::" + if [ ! "${showDmesg}" ]; then + echo "::endgroup::" + fi fi if [ -n "${GITHUB_ACTIONS:-}" ]; then