-
Notifications
You must be signed in to change notification settings - Fork 59
user journalctl instead of catch kernel log from /var/log/kern.log #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
use journalctl command instead of this step: 1. get kernel bootup line number by sof-get-kernel-line.sh 2. user step 1 information to dump the kernel log from /var/log/kern.log file now direct use journalctl to dump the kernel log after system bootup Signed-off-by: Wu, BinX <binx.wu@intel.com>
with replace kern.log file the keyword filter already changed from '] sof-audio' to 'sof-audio' so need refine the case filter Signed-off-by: Wu, BinX <binx.wu@intel.com>
use journalctl command instead of query the begin line from /var/log/kern.log file This change also modify all script which refer load sof-kernel-log-check file Signed-off-by: Wu, BinX <binx.wu@intel.com>
use journalctl instead of catch information from /var/log/kern.log file 1. DMESG_LOG_START_LINE => CASE_KERNEL_START_TIME 2. with this change, sof-get-kernel-line is not useful, remove it Signed-off-by: Wu, BinX <binx.wu@intel.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to replace a fairly complex computation of a shifting "begin_line" with something that always returns the same boot time. So I don't understand.
Can you detail what sort of failures and Call Traces this was tested with?
I see 4 commits, are they really changes that could be merged one at a time? If yes then could you maybe split this PR into multiple PRs? If no then squash them together.
| #!/bin/bash | ||
|
|
||
| begin_line=${1:-1} | ||
| begin_time=${1:-0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment explaining when zero is a valid value, why and what it does.
| #[[ $kernel_buffer_size -lt $dmesg ]] && cmd="dmesg" || cmd="sed -n '$begin_line,\$p' /var/log/kern.log" | ||
| [[ ! "$err_str" ]] && { | ||
| echo "Missing error keyword list" | ||
| builtin exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think builtin exit still makes a difference since #229 . Either remove this builtin or reset the trap
PS: don't fix all the other builtin in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the script on tools, we direct to load them as command,
so the trap exit is not effect them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still lost sorry. So let's focus on the present: what does builtin achieve here now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the older code use exit as function to overwrite exit command,
so we need builtin exit to let them not confuse, now we use the trap exit
it looks we can change builtin exit to exit at sof-test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks we can change builtin exit to exit at sof-test
Thanks, that's one of the things I meant. Keeping builtin is confusing. However it's not the only thing.
Before #229 you could avoid the exit handler thanks to builtin. How do you avoid the exit handler now after #229? Discuss this second thing in #229, not here.
| [[ "$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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== is a bashim inside [ ] which is not a bashism. It works but it's not guaranteed to work. For something so simple just use [ = ].
| if [[ -n "$DMESG_LOG_START_LINE" && "$DMESG_LOG_START_LINE" -ne 0 ]]; then | ||
| tail -n +"$DMESG_LOG_START_LINE" /var/log/kern.log |cut -f5- -d ' ' > "$LOG_ROOT/dmesg.txt" | ||
| if [[ -n "$CASE_KERNEL_START_TIME" ]]; then | ||
| journalctl --flush |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why --flush here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use to confirm data already store, so I can remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
journalctl --flush can help only if there is a system crash soon. If don't expect a crash between this line and the next line, do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when we load this part at exit, so it seems don't need line
|
|
||
| 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=$(eval "$cmd"|grep 'Call Trace' -A5 -B3)$(eval "$cmd" | grep $project_key | grep -E "$err_str"|grep -vE "$ignore_str") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again it's not clear what the eval achieve here.
PS: do not remove all useless eval, only the modified ones.
| date -d "$begin_time" +'%F %T' > /dev/null || { | ||
| echo "Error parameter for date: $begin_time" | ||
| echo "Support date format: date +'%F %T'" | ||
| builtin exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think builtin works since #229
| journalctl --dmesg --no-pager --no-hostname -o short-precise --since="$CASE_KERNEL_START_TIME" > "$LOG_ROOT/dmesg.txt" | ||
| else | ||
| cut -f5- -d ' ' /var/log/kern.log > "$LOG_ROOT/dmesg.txt" | ||
| journalctl --dmesg --no-pager --no-hostname -o short-precise > "$LOG_ROOT/dmesg.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put --no-pager --no-hostname -o short-precise into a new JOURNALCTL_FORMAT_OPTS variable so they can be modified in one place.
|
OK, I will split them into different PR, For the |
|
PR: #251 : tools: sof-kernel-dump: use journalctl command to query kernel log |
|
PR: #252 test-case: verify-sof-firware-load: update filter of fireware keyword |
|
PR: #262 tools: sof-kernel-log-check: use journalctl command to query kernel log |
|
PR: #263 lib: hijack: use journalctl command to dump kernel information |
|
@Bin-QA |
|
@fredoh9 I already split the PR to different PR, which apply the change advice and fix |
Use
journalctlcommand instead of catch kernel log from /var/log/kern.log filethis change will effect those:
DMESG_LOG_START_LINEchange toCASE_KERNEL_START_TIMEKERNEL_LAST_LINEchange toKERNEL_LAST_TIMElimit:
journalctlbase on system time stamp, so need confirm DUT time stamp is correct