Skip to content

Commit

Permalink
verify-kernel-boot-log.sh: cap boot logs to 6000 max_lines
Browse files Browse the repository at this point in the history
Protect storage in case this is not run first and immediately after boot
as it should. Also makes the logs more relevant and usable: long files
can make the user interface unusable, see example in
thesofproject/sof#8761

This also gives us --no-pager "for free" in case it was ever needed.

Fixes recent commits c8565e8 and 914c5c0.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb committed May 16, 2024
1 parent f47c38e commit a794795
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test-case/verify-kernel-boot-log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ boot_log_exit_handler()
{
local exit_code=$1

# This script is normally run first and immediately after boot. 'max_lines' protects
# storage in case it's not (and debug logs are on!). Long logs also make the user
# interface unresponsive, see example in (unrelated)
# https://github.com/thesofproject/sof/issues/8761.
#
# A typical boot log with SOF debug is 3000 lines, see more numbers in
# detect_log_flood() comments below. Double that to be on the safe side.
local max_lines=6000

# For issues with sound daemons, display, USB, network, NTP, systemd, etc.
journalctl --boot > "$LOG_ROOT"/boot_log.txt
journalctl --boot | head -n "$max_lines" > "$LOG_ROOT"/boot_log.txt
# More focused
journalctl --dmesg > "$LOG_ROOT"/dmesg.txt
journalctl --dmesg | head -n "$max_lines" > "$LOG_ROOT"/dmesg.txt

print_test_result_exit "$exit_code"
}
Expand Down Expand Up @@ -174,6 +183,9 @@ detect_log_flood()
# `systemctl --user status org.gnome.Shell@wayland.service`
# as "FAILED" after a couple minutes trying so there's no risk of
# missing the problem.

# If this has to change in the future then 'max_lines' above should
# probably be updated too.
if [ "$recent_lines" -lt 6000 ]; then
return 0
fi
Expand Down

0 comments on commit a794795

Please sign in to comment.