Uh oh!
There was an error while loading. Please reload this page.
- 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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
a0e34635d95b80419ee3e1a1257cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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 ContributorAuthor 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.
ContributorAuthor 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. ContributorAuthor 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 ContributorAuthor 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 ...ContributorAuthor 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.
Uh oh!There was an error while loading. Please reload this page. | ||
| 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -30,7 +30,7 @@ OPT_OPT_lst['p']='pulseaudio' OPT_DESC_lst['p']='disable pulseaudio on the tes | ||
| OPT_PARM_lst['p']=0 OPT_VALUE_lst['p']=1 | ||
| func_opt_parse_option "$@" | ||
| func_lib_setup_kernel_last_line | ||
| func_lib_setup_kernel_last_time | ||
| loop_cnt=${OPT_VALUE_lst['l']} | ||
| usb_audio_module="snd_usb_audio" | ||
| @@ -48,7 +48,7 @@ for idx in $(seq 1 $loop_cnt) | ||
| do | ||
| dlogi "===== Starting iteration $idx of $loop_cnt =====" | ||
| ## - 1: remove module section | ||
| func_lib_setup_kernel_last_line | ||
| func_lib_setup_kernel_last_time | ||
marc-hb marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # After module removal, it takes about 10s for "aplay -l" to show | ||
| # device list, within this 10s, it shows "no soundcard found". Here | ||
| @@ -77,21 +77,21 @@ do | ||
| ## - 1a: check for errors after removal | ||
| dlogi "checking for general errors after kmod unload with sof-kernel-log-check tool" | ||
| sof-kernel-log-check.sh $KERNEL_LAST_LINE | ||
| sof-kernel-log-check.sh "$KERNEL_LAST_TIME" | ||
| if [[ $? -ne 0 ]]; then | ||
| dloge "error found after kmod unload is real error, failing" | ||
| exit 1 | ||
| fi | ||
| func_lib_setup_kernel_last_line | ||
| func_lib_setup_kernel_last_time | ||
| dlogi "run kmod/sof_insert.sh" | ||
| sudo sof_insert.sh | ||
| [[ $? -ne 0 ]] && dloge "insert modules error" && exit | ||
| sleep 1 | ||
| ## - 2a: check for errors after insertion | ||
| dlogi "checking for general errors after kmod insert with sof-kernel-log-check tool" | ||
| sof-kernel-log-check.sh $KERNEL_LAST_LINE | ||
| sof-kernel-log-check.sh "$KERNEL_LAST_TIME" | ||
| if [[ $? -ne 0 ]]; then | ||
| dloge "Found error(s) in kernel log after module insertion" | ||
| exit 1 | ||
Uh oh!
There was an error while loading. Please reload this page.
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.