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
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ apl
* sof-get-default-tplg.sh
<br> Load the tplg file name from system log which is recorded from system bootup

* sof-get-kernel-line.sh
<br> Print all kernel versions and their line numbers from /var/log/kern.log,
with the most recent <first/last>

* sof-kernel-dump.sh
<br> Catch all kernel information after system boot up from /var/log/kern.log file

Expand Down
11 changes: 3 additions & 8 deletions case-lib/hijack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,10 @@ 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Single [ ] are enough for this.

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"
fi

# get ps command result as list
Expand Down
9 changes: 4 additions & 5 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,8 @@ 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;}')
if [ ! "$CASE_KERNEL_START_TIME" ]; then
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 not a fan of the empty expression [ ], do you mind the more explicit [ -n "$CASE_KERNEL_START_TIME" ]? Consistent with hijack.sh above

# format time stamp output for journalctl command
func_lib_setup_kernel_last_time
CASE_KERNEL_START_TIME="$KERNEL_LAST_TIME"
fi
4 changes: 2 additions & 2 deletions test-case/check-reboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ sudo chown $UID $boot_file
old_content="$(cat $boot_file|grep -v '^exit')"
# write the information to /etc/rc.local
# LOG_ROOT to make sure all tests, including sub-cases, write log to the same target folder
# DMESG_LOG_START_LINE to just keep last kernel bootup log
# CASE_KERNEL_START_TIME to just keep last kernel bootup log
boot_once_flag=$(realpath $(which sof-boot-once.sh))
cat << END > $boot_file
$old_content

$boot_once_flag
export LOG_ROOT='$(realpath $LOG_ROOT)'
export DMESG_LOG_START_LINE=$(wc -l /var/log/kern.log|awk '{print $1;}')
export CASE_KERNEL_START_TIME='$(journalctl --dmesg --no-pager -n 1 |head -n 1|awk '{print $(NF-3)" "$(NF-2);}')'
Copy link
Collaborator

Choose a reason for hiding this comment

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

That doesn't seem to be the kernel start time, did you test this?

Anything wrong with uptime -s?

bash -c '$full_cmd'

exit 0
Expand Down
4 changes: 2 additions & 2 deletions test-case/check-sof-logger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func_opt_parse_option "$@"

#TODO: need to add arguments for user to give location for logger and ldc file

# hijack DMESG_LOG_START_LINE which refer dump kernel log in exit function
DMESG_LOG_START_LINE=$(sof-get-kernel-line.sh|tail -n 1 |awk '{print $1;}')
# hijack CASE_KERNEL_START_TIME which refer dump kernel log in exit function
unset CASE_KERNEL_START_TIME

# check sof-logger location
if [ -z $(which sof-logger) ]; then
Expand Down
4 changes: 2 additions & 2 deletions test-case/verify-kernel-module-load-probe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh

func_opt_parse_option "$@"

# hijack DMESG_LOG_START_LINE which refer dump kernel log in exit function
DMESG_LOG_START_LINE=$(sof-get-kernel-line.sh|tail -n 1 |awk '{print $1;}')
# hijack CASE_KERNEL_START_TIME which refer dump kernel log in exit function
unset CASE_KERNEL_START_TIME

dlogi "Checking if sof relative modules loaded"
dlogc "lsmod | grep \"sof\""
Expand Down
4 changes: 2 additions & 2 deletions test-case/verify-pcm-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ tplg=${OPT_VALUE_lst['t']}
tplg_path=`func_lib_get_tplg_path "$tplg"`
[[ "$?" != "0" ]] && dloge "No available topology for this test case" && exit 1

# hijack DMESG_LOG_START_LINE which refer dump kernel log in exit function
DMESG_LOG_START_LINE=$(sof-get-kernel-line.sh|tail -n 1 |awk '{print $1;}')
# hijack CASE_KERNEL_START_TIME which refer dump kernel log in exit function
unset CASE_KERNEL_START_TIME

tplg_str="$(sof-tplgreader.py $tplg_path -d id pcm type -o)"
pcm_str="$(sof-dump-status.py -i ${SOFCARD:-0})"
Expand Down
4 changes: 2 additions & 2 deletions test-case/verify-sof-firmware-load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
func_opt_parse_option "$@"

if [ ! "$(alias |grep 'Sub-Test')" ];then
# hijack DMESG_LOG_START_LINE which refer dump kernel log in exit function
DMESG_LOG_START_LINE=$(sof-get-kernel-line.sh|tail -n 1 |awk '{print $1;}')
# hijack CASE_KERNEL_START_TIME which refer dump kernel log in exit function
unset CASE_KERNEL_START_TIME
cmd="sof-kernel-dump.sh"
else
cmd="dmesg"
Expand Down
12 changes: 0 additions & 12 deletions tools/sof-get-kernel-line.sh

This file was deleted.