Skip to content

Conversation

@Bin-QA
Copy link
Contributor

@Bin-QA Bin-QA commented Jun 10, 2020

Use journalctl command instead of catch kernel log from /var/log/kern.log file
this change will effect those:

  1. tools/sof-kernel-dump.sh script
  2. tools/sof-kernel-log-check.sh script
  3. tools/sof-get-kernel-line to droped
  4. lib.sh/DMESG_LOG_START_LINE change to CASE_KERNEL_START_TIME
  5. lib.sh/KERNEL_LAST_LINE change to KERNEL_LAST_TIME

limit: journalctl base on system time stamp, so need confirm DUT time stamp is correct

Bin-QA added 3 commits June 8, 2020 22:35
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>
Copy link
Collaborator

@marc-hb marc-hb left a 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}
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why --flush here?

Copy link
Contributor Author

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?

Copy link
Collaborator

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?

Copy link
Contributor Author

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")
Copy link
Collaborator

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
Copy link
Collaborator

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"
Copy link
Collaborator

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.

@Bin-QA
Copy link
Contributor Author

Bin-QA commented Jun 11, 2020

OK, I will split them into different PR,
I just think it is all refer the /var/log/kern.log query,
so I add them into one PR

For the call trace I find them at journalctl,
so I decide to replace query from /var/log/kern.log to journalctl
but for the really usage, I'm afraid need to query this kernel for test

@Bin-QA
Copy link
Contributor Author

Bin-QA commented Jun 11, 2020

PR: #251 : tools: sof-kernel-dump: use journalctl command to query kernel log

@Bin-QA
Copy link
Contributor Author

Bin-QA commented Jun 11, 2020

PR: #252 test-case: verify-sof-firware-load: update filter of fireware keyword

@Bin-QA
Copy link
Contributor Author

Bin-QA commented Jun 28, 2020

PR: #262 tools: sof-kernel-log-check: use journalctl command to query kernel log

@Bin-QA
Copy link
Contributor Author

Bin-QA commented Jun 28, 2020

PR: #263 lib: hijack: use journalctl command to dump kernel information

@fredoh9
Copy link
Contributor

fredoh9 commented Jun 28, 2020

@Bin-QA journalctl --flush need sudo permission. Without it I have this error.

Failed to connect to /run/systemd/journal/io.systemd.journal: Permission denied

@Bin-QA
Copy link
Contributor Author

Bin-QA commented Jun 28, 2020

@fredoh9 I already split the PR to different PR, which apply the change advice and fix journalctl --flush

@Bin-QA
Copy link
Contributor Author

Bin-QA commented Jun 30, 2020

with split this PR to 4 PR: #251 , #252 , #262 , #263 close current

@Bin-QA Bin-QA closed this Jun 30, 2020
@Bin-QA Bin-QA deleted the journalctl branch June 30, 2020 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants