From a7947954ac3d424fb7f9ebff5c00628f9e8fbac3 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 15 May 2024 11:23:03 -0700 Subject: [PATCH] verify-kernel-boot-log.sh: cap boot logs to 6000 max_lines 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 https://github.com/thesofproject/sof/issues/8761 This also gives us --no-pager "for free" in case it was ever needed. Fixes recent commits c8565e8b210d and 914c5c06e075. Signed-off-by: Marc Herbert --- test-case/verify-kernel-boot-log.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test-case/verify-kernel-boot-log.sh b/test-case/verify-kernel-boot-log.sh index 93caa667..167482da 100755 --- a/test-case/verify-kernel-boot-log.sh +++ b/test-case/verify-kernel-boot-log.sh @@ -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" } @@ -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