Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion case-lib/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ TPLG_ROOT=${TPLG_ROOT:-/lib/firmware/intel/sof-tplg}
# example: ignore 'pcms that are HDA Digital & HDA Analog'
# TPLG_IGNORE_LST['pcm']='HDA Digital,HDA Analog'
declare -A TPLG_IGNORE_LST
# shellcheck disable=SC2034 # use by pipeline.sh/func_pipeline_export
TPLG_IGNORE_LST['pcm']='HDA Digital,Media Playback,DMIC16k'

# Will be set by the lib function, don't need to set
# Catches the last line of /var/log/kern.log, which will be used by
# Catches the kernel last line of time stamp by journalctl, which will be used by
# sof-kernel-log-check.
# KERNEL_LAST_LINE

Expand Down
4 changes: 3 additions & 1 deletion case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ fi
func_lib_setup_kernel_last_line()
{
# shellcheck disable=SC2034 # external script will use it
KERNEL_LAST_LINE=$(wc -l /var/log/kern.log|awk '{print $1;}')
KERNEL_LAST_LINE=$(journalctl --dmesg --no-pager -n 1 -o short-iso-precise|awk '/kernel/ {print $1;}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my system this prints the boot time (uptime -s) which doesn't seem to match what was before.

Should this simply be KERNEL_LAST_LINE=$(date)?

I like that you're trying to save a lot of changed lines by keeping the KERNEL_LAST_LINE name the same, however there should be a big fat warning comment saying "This is not a line anymore"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rename the whole thing as KERNEL_LAST_TIMESTAMP in PR #354

KERNEL_LAST_LINE=${KERNEL_LAST_LINE:0:-5}
KERNEL_LAST_LINE=${KERNEL_LAST_LINE/T/ }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a comment explaining what this removes and why. It's surprising to drop such a critical piece of information.

}

SOF_LOG_COLLECT=0
Expand Down
39 changes: 20 additions & 19 deletions tools/sof-kernel-log-check.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
#!/bin/bash

begin_line=${1:-1}
begin_time="${@:-0}"
declare err_str ignore_str project_key
err_str="error|failed|timed out|panic|oops"
ignore_str="error: debugfs write failed to idle -16|error: status|iteration [01]"
project_key="sof-audio"

[[ ! "$err_str" ]] && echo "Missing error keyword list" && exit 0
# dmesg KB size buffer size
#dmesg_config_define=$(awk -F '=' '/CONFIG_LOG_BUF_SHIFT/ {print $2;}' /boot/config-$(uname -r))
#dmesg_buffer_size=$( echo $(( (1<<$dmesg_config_define) / 1024 )) )
# kernel file log buffer size
#kernel_buffer_size=$(du -k /var/log/kern.log |awk '{print $1;}')
# now decide using which to catch the kernel log
#[[ $kernel_buffer_size -lt $dmesg ]] && cmd="dmesg" || cmd="sed -n '$begin_line,\$p' /var/log/kern.log"
[[ ! "$err_str" ]] && {
echo "Missing error keyword list"
exit 0
}

# confirm begin_line is number, if it is not the number, direct using dmesg
[[ "${begin_line//[0-9]/}" ]] && begin_line=0
[[ "$begin_line" -eq 0 ]] && cmd="dmesg" || cmd="sed -n '$begin_line,\$p' /var/log/kern.log"

#echo "run $0 with parameter '$*' for check kernel message error"
if [ "X$begin_time" == "X0" ]; then
cmd="dmesg"
else
date -d "$begin_time" +'%F %T' > /dev/null || {
echo "Error parameter for date: $begin_time"
echo "Support date format: date +'%F %T'"
exit 0
}
cmd="journalctl --dmesg --no-pager --no-hostname -o short-precise --since='$begin_time'"
fi

if [ "$ignore_str" ]; then
err=$(eval $cmd|grep 'Call Trace' -A5 -B3)$(eval $cmd | grep $project_key | grep -E "$err_str"|grep -vE "$ignore_str")
err=$("$cmd" |grep 'Call Trace' -A5 -B3)$("$cmd" | grep $project_key | grep -E "$err_str"|grep -vE "$ignore_str")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit these cleanups first and separately so they don't noise the functional changes later.

else
err=$(eval $cmd|grep 'Call Trace' -A5 -B3)$(eval $cmd | grep $project_key | grep -E "$err_str")
err=$("$cmd" |grep 'Call Trace' -A5 -B3)$("$cmd" | grep $project_key | grep -E "$err_str")
fi

if [ "$err" ]; then
echo `date -u '+%Y-%m-%d %T %Z'` "[ERROR]" "Caught dmesg error"
echo "$(date -u '+%F %T %Z') [ERROR] Caught dmesg error"
echo "===========================>>"
echo "$err"
echo "<<==========================="
builtin exit 1
exit 1
fi

builtin exit 0
exit 0