-
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
Changes from all commits
a0e3463
5d95b80
419ee3e
1a1257c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,15 +20,11 @@ function func_exit_handler() | |
| sleep 1s | ||
| fi | ||
| # when case ends, store kernel log | ||
| # /var/log/kern.log format: | ||
| # f1 f2 f3 f4 f5 f6 f7 f8... | ||
| # Mouth day Time MachineName kernel: [ time] content | ||
| # May 15 21:28:38 MachineName kernel: [ 6.469255] sof-audio-pci 0000:00:0e.0: ipc rx: 0x90020000: GLB_TRACE_MSG | ||
| # May 15 21:28:38 MachineName kernel: [ 6.469268] sof-audio-pci 0000:00:0e.0: ipc rx done: 0x90020000: GLB_TRACE_MSG | ||
| 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just use to confirm data already store, so I can remove it?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when we load this part at |
||
| 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" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please put |
||
| fi | ||
|
|
||
| # get ps command result as list | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,10 +38,12 @@ if [ ! "$SOFCARD" ]; then | |
| SOFCARD=$(grep '\]: sof-[a-z]' /proc/asound/cards|awk '{print $1;}') | ||
| fi | ||
|
|
||
| func_lib_setup_kernel_last_line() | ||
| func_lib_setup_kernel_last_time() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not return the "last" time, this returns the boot time?! "last line" was the last line in kern.log, I understand that. I don't understand what "last time" could mean.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As test step, we don't want check full kernel log, older code is for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So still use
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I think I understand now. When using time, you don't have to care about lines any more (that confused me a bit). Instead you can just do this: set_test_start_time()
{
test_start_epoch=$(date +%s)
}
# test runs ...
journalctl --since="$test_start_epoch" $JOURNACTL_FORMAT_OPTS ...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know |
||
| { | ||
| # shellcheck disable=SC2034 # external script will use it | ||
| KERNEL_LAST_LINE=$(wc -l /var/log/kern.log|awk '{print $1;}') | ||
| KERNEL_LAST_TIME=$(journalctl --dmesg --no-pager -n 1 -o short-iso-precise|awk '/kernel/ {print $1;}') | ||
marc-hb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| KERNEL_LAST_TIME=${KERNEL_LAST_TIME:0:-5} | ||
| KERNEL_LAST_TIME=${KERNEL_LAST_TIME/T/ } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discarding the timezone is dangerous. It will cause bugs at least once per year when daylight savings. Use |
||
| } | ||
|
|
||
| SOF_LOG_COLLECT=0 | ||
|
|
@@ -191,9 +193,9 @@ func_lib_get_tplg_path() | |
| return 0 | ||
| } | ||
|
|
||
| # force ask buffer data write into file system | ||
| sudo sync -f | ||
| # catch kern.log last line as current case start line | ||
| if [ ! "$DMESG_LOG_START_LINE" ]; then | ||
| DMESG_LOG_START_LINE=$(wc -l /var/log/kern.log|awk '{print $1;}') | ||
| journalctl --flush | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if [ ! "$CASE_KERNEL_START_TIME" ]; then | ||
| # format time stamp output for journalctl command | ||
| func_lib_setup_kernel_last_time | ||
| CASE_KERNEL_START_TIME="$KERNEL_LAST_TIME" | ||
| fi | ||
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 explain in a comment when CASE_KERNEL_START_TIME is missing and why.