Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
9828d66
test: verify-sof-firmware-load: use journalctl to get kernel logs
xiulipan Oct 23, 2020
99e1a97
tools: sof-get-default-tplg: use journalctl as default kernel log reader
xiulipan Oct 22, 2020
0d8bd70
tools: sof-kernel-log-check: fix script direct run
xiulipan Oct 23, 2020
e69b36b
tools: sof-kernel-log-check: use journalctl to get kernel logs
xiulipan Oct 23, 2020
23fa1ee
tools: sof-kernel-log-check: add some common error logs can be ignored
xiulipan Oct 28, 2020
d4de517
test-case: check-pause-resume: check kernel log in each iteration
xiulipan Oct 28, 2020
e12e5ee
test-case: check-runtime-pm-status: check kernel log in each iteration
xiulipan Oct 28, 2020
0a02227
test-case: check-ipc-flood: check kernel log in each iteration
xiulipan Oct 28, 2020
2fffcb7
test-case: check-suspend-resume: check kernel log in each iteration
xiulipan Oct 28, 2020
d3b2714
test-case: check-suspend-resume-with-audio: check kernel log in each …
xiulipan Oct 28, 2020
62a95c6
test-case: check-runtime-pm-double-active: check kernel log in each i…
xiulipan Oct 28, 2020
8db6f8c
test-case: multiple-pause-resume: check kernel log in each iteration
xiulipan Oct 28, 2020
40b6cb8
test-case: multiple-pipeline-playback: check kernel log in each itera…
xiulipan Oct 28, 2020
62c98eb
test-case: multiple-pipeline-capture: check kernel log in each iteration
xiulipan Oct 28, 2020
91e4116
test-case: simultaneous-playback-capture: check kernel log in each it…
xiulipan Oct 28, 2020
43c3ca6
test: verify-sof-firmware-load: flush and sync journalctl logs
xiulipan Oct 28, 2020
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
6 changes: 3 additions & 3 deletions case-lib/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ declare -A TPLG_IGNORE_LST
TPLG_IGNORE_LST['pcm']='HDA Digital'

# Will be set by the lib function, don't need to set
# Catches the last line of /var/log/kern.log, which will be used by
# sof-kernel-log-check.
# KERNEL_LAST_LINE
# Catches the timestamp for a test case start used by
# sof-kernel-log-check with journalctl
# KERNEL_LAST_TIMESTAMP

# If not set will be automatically set by logging_ctl function
# Test case log root
Expand Down
4 changes: 2 additions & 2 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ 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_timestamp()
{
# shellcheck disable=SC2034 # external script will use it
KERNEL_LAST_LINE=$(wc -l /var/log/kern.log|awk '{print $1;}')
KERNEL_LAST_TIMESTAMP=$(date +%s)
}

# This function adds a fake error to dmesg (which is always saved by
Expand Down
4 changes: 2 additions & 2 deletions test-case/check-capture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ file_prefix=${OPT_VALUE_lst['f']}

[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect

func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp
func_lib_check_sudo
func_pipeline_export $tplg "type:capture & ${OPT_VALUE_lst['S']}"

Expand Down Expand Up @@ -106,5 +106,5 @@ do
done
done

sof-kernel-log-check.sh $KERNEL_LAST_LINE
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP
exit $?
4 changes: 2 additions & 2 deletions test-case/check-fw-echo-reference.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ frequency=${OPT_VALUE_lst['f']}
[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect

func_pipeline_export $tplg "echo:any"
func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp

if [ "$PIPELINE_COUNT" != "2" ]; then
die "Only detect $PIPELINE_COUNT pipeline(s) from topology, but two are needed"
Expand Down Expand Up @@ -93,4 +93,4 @@ do
done
done

sof-kernel-log-check.sh "$KERNEL_LAST_LINE"
sof-kernel-log-check.sh "$KERNEL_LAST_TIMESTAMP"
16 changes: 8 additions & 8 deletions test-case/check-ipc-flood.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ loop_cnt=${OPT_VALUE_lst['l']}

[[ ! "$(sof-kernel-dump.sh|grep 'sof-audio'|grep 'Firmware debug build')" ]] && dlogw "${BASH_SOURCE[0]} need debug version firmware" && exit 2

func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp
func_lib_check_sudo

dlogi "Check sof debug fs environment"
[[ "$(sudo file $ipc_flood_dfs|grep 'No such file')" ]] && dlogw "${BASH_SOURCE[0]} need $ipc_flood_dfs to run the test case" && exit 2
dlogi "Checking ipc flood test!"

# cleanup dmesg buffer before test
sudo dmesg -c > /dev/null

for i in $(seq 1 $loop_cnt)
do
# cleanup dmesg buffer for each iteration
sudo dmesg -c > /dev/null
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this still required?

# set up timestamp for each iteration
func_lib_setup_kernel_last_timestamp
dlogi "===== [$i/$loop_cnt] loop Begin ====="
dlogc "sudo bash -c 'echo $lpc_loop_cnt > $ipc_flood_dfs'"
sudo bash -c "'echo $lpc_loop_cnt > $ipc_flood_dfs'"

sof-kernel-log-check.sh 0 || die "Catched error in dmesg"
# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP || die "Catch error in kernel log"
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment here. lets fix it everywhere


dlogi "Dumping test logs!"
dmesg | grep "IPC Flood count" -A 2
done

sof-kernel-log-check.sh $KERNEL_LAST_LINE
exit 0
done
4 changes: 2 additions & 2 deletions test-case/check-keyword-detection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ duration=${OPT_VALUE_lst['d']}
[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect

func_pipeline_export $tplg "kpbm:any"
func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp

if test "$PIPELINE_COUNT" != "1"; then
die "detected $PIPELINE_COUNT wov pipeline(s) from topology, but 1 is needed"
Expand Down Expand Up @@ -154,4 +154,4 @@ do
done
done

sof-kernel-log-check.sh "$KERNEL_LAST_LINE"
sof-kernel-log-check.sh "$KERNEL_LAST_TIMESTAMP"
10 changes: 5 additions & 5 deletions test-case/check-kmod-load-unload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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_timestamp

loop_cnt=${OPT_VALUE_lst['l']}

Expand All @@ -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_timestamp

# After module removal, it takes about 10s for "aplay -l" to show
# device list, within this 10s, it shows "no soundcard found". Here
Expand All @@ -75,10 +75,10 @@ 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_TIMESTAMP" ||
die "error found after kmod unload is real error, failing"

func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp
dlogi "run kmod/sof_insert.sh"
sudo sof_insert.sh || {
# FIXME: don't exit the status of dloge(). Use die()
Expand All @@ -87,7 +87,7 @@ do

## - 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_TIMESTAMP" ||
die "Found error(s) in kernel log after module insertion"

dlogi "checking if firmware is loaded successfully"
Expand Down
4 changes: 2 additions & 2 deletions test-case/check-pause-release-suspend-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ esac

[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect

func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp

dlogi "Entering audio stream expect script with: $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q"
dlogi "Will enter suspend-resume cycle during paused period of audio stream process"
Expand Down Expand Up @@ -180,5 +180,5 @@ if [ $ret -ne 0 ]; then
[[ $? -ne 0 ]] && dlogw "Kill process catch error"
exit $ret
fi
sof-kernel-log-check.sh $KERNEL_LAST_LINE
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP
exit $?
10 changes: 4 additions & 6 deletions test-case/check-pause-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ esac
[[ -z $file_name ]] && file_name=$dummy_file

func_pipeline_export $tplg "type:$test_mode & ${OPT_VALUE_lst['S']}"
func_lib_setup_kernel_last_line
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
do
# set up timestamp for each iteration
func_lib_setup_kernel_last_timestamp
channel=$(func_pipeline_parse_value $idx channel)
rate=$(func_pipeline_parse_value $idx rate)
fmt=$(func_pipeline_parse_value $idx fmt)
Expand Down Expand Up @@ -122,9 +123,6 @@ END
[[ $? -ne 0 ]] && dlogw "Kill process catch error"
exit $ret
fi
# sof-kernel-log-check script parameter number is 0/Non-Number will force check from dmesg
sof-kernel-log-check.sh 0 || die "Catch error in dmesg"
# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP || die "Catch error in kernel log"
Copy link
Contributor

Choose a reason for hiding this comment

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

Caught error instead of Catch error

done

sof-kernel-log-check.sh $KERNEL_LAST_LINE
exit $?
4 changes: 2 additions & 2 deletions test-case/check-playback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ else
dlogi "using $file as playback source"
fi

func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp
func_lib_check_sudo
func_pipeline_export $tplg "type:playback & ${OPT_VALUE_lst['S']}"

Expand Down Expand Up @@ -104,4 +104,4 @@ do
done
done

sof-kernel-log-check.sh "$KERNEL_LAST_LINE"
sof-kernel-log-check.sh "$KERNEL_LAST_TIMESTAMP"
11 changes: 4 additions & 7 deletions test-case/check-runtime-pm-double-active.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ DEV_LST['capture']='/dev/null'

[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect
func_pipeline_export $tplg "type:any"
func_lib_setup_kernel_last_line

for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
do
Expand All @@ -87,10 +86,10 @@ do
dummy_file="${DEV_LST[$type]}"
[[ -z $cmd ]] && dloge "$type is not supported, $cmd, $dummy_file" && exit 2

# clean up dmesg before the test
sudo dmesg -C
for i in $(seq 1 $loop_count)
do
# set up timestamp for each iteration
func_lib_setup_kernel_last_timestamp
dlogi "===== Iteration $i of $loop_count for $pcm ====="
# playback or capture device - check status
dlogc "$cmd -D $dev -r $rate -c $channel -f $fmt $dummy_file -q"
Expand Down Expand Up @@ -136,10 +135,8 @@ do
func_lib_lsof_error_dump $snd
die "playback/capture failed on $pcm, $dev at $i/$loop_cnt."
fi
# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP || die "Catch error in kernel log"
done

sof-kernel-log-check.sh 0 || die "Catch error in dmesg"
done

sof-kernel-log-check.sh $KERNEL_LAST_LINE
exit $?
9 changes: 4 additions & 5 deletions test-case/check-runtime-pm-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ DEV_LST['capture']='/dev/null'

[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect
func_pipeline_export $tplg "type:any"
func_lib_setup_kernel_last_line

for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
do
Expand All @@ -83,6 +82,8 @@ do

for i in $(seq 1 $loop_count)
do
# set up timestamp for each iteration
func_lib_setup_kernel_last_timestamp
dlogi "===== Iteration $i of $loop_count for $pcm ====="
# playback or capture device - check status
dlogc "$cmd -D $dev -r $rate -c $channel -f $fmt $dummy_file -q"
Expand Down Expand Up @@ -122,10 +123,8 @@ do
func_lib_lsof_error_dump $snd
exit 1
fi
# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP || die "Catch error in kernel log"
done

sof-kernel-log-check.sh 0 || die "Catch error in dmesg"
done

sof-kernel-log-check.sh $KERNEL_LAST_LINE
exit $?
4 changes: 2 additions & 2 deletions test-case/check-signal-stop-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ case $test_mode in
;;
esac

func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp

func_stop_start_pipeline()
{
Expand Down Expand Up @@ -116,5 +116,5 @@ do
kill -9 $pid && wait $pid 2>/dev/null
done

sof-kernel-log-check.sh $KERNEL_LAST_LINE
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP
exit $?
4 changes: 2 additions & 2 deletions test-case/check-smart-amplifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ tplg=${OPT_VALUE_lst['t']}
[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect

func_pipeline_export $tplg "smart_amp:any"
func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp

[ "$PIPELINE_COUNT" == "2" ] || die "Only detect $PIPELINE_COUNT pipeline(s) from topology, but two are needed"

Expand Down Expand Up @@ -114,4 +114,4 @@ do
done
done

sof-kernel-log-check.sh "$KERNEL_LAST_LINE"
sof-kernel-log-check.sh "$KERNEL_LAST_TIMESTAMP"
22 changes: 10 additions & 12 deletions test-case/check-suspend-resume-with-audio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ OPT_PARM_lst['f']=1 OPT_VALUE_lst['f']=''

func_opt_parse_option "$@"
func_lib_check_sudo
func_lib_setup_kernel_last_line

tplg=${OPT_VALUE_lst['t']}
[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect
Expand Down Expand Up @@ -88,6 +87,8 @@ fi

for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
do
# set up timestamp for each iteration
func_lib_setup_kernel_last_timestamp
channel=$(func_pipeline_parse_value $idx channel)
rate=$(func_pipeline_parse_value $idx rate)
fmt=$(func_pipeline_parse_value $idx fmt)
Expand All @@ -111,24 +112,21 @@ do
ps --ppid $$ -f
exit 1
fi
$(dirname ${BASH_SOURCE[0]})/check-suspend-resume.sh $(echo $opt)
ret=$?
[[ $ret -ne 0 ]] && dloge "suspend resume failed" && exit $ret
$(dirname ${BASH_SOURCE[0]})/check-suspend-resume.sh $(echo $opt) || die "suspend resume failed"

# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh $KERNEL_LAST_TIMESTAMP || die "Catch error in kernel log"

# check process status is correct
sof-process-state.sh $process_id
if [ $? -ne 0 ]; then
sof-process-state.sh $process_id || {
func_lib_lsof_error_dump $snd
dloge "process status is abnormal"
dlogi "dump ps for aplay & arecord"
ps -ef |grep -E 'aplay|arecord'
dlogi "dump ps for child process"
ps --ppid $$ -f
exit 1
fi
}
dlogi "Killing $cmd_args"
kill -9 $process_id
sof-kernel-log-check.sh 0 || die "Catch error in dmesg"
kill -9 $process_id || true
done

# check full log
sof-kernel-log-check.sh $KERNEL_LAST_LINE
18 changes: 8 additions & 10 deletions test-case/check-suspend-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ OPT_PARM_lst['r']=0 OPT_VALUE_lst['r']=0

func_opt_parse_option "$@"
func_lib_check_sudo
func_lib_setup_kernel_last_line
func_lib_setup_kernel_last_timestamp

type=${OPT_VALUE_lst['T']}
# switch type
Expand Down Expand Up @@ -74,22 +74,20 @@ fi
for i in $(seq 1 $loop_count)
do
dlogi "===== Round($i/$loop_count) ====="
# cleanup dmesg befor run case
sudo dmesg --clear
# set up timestamp for each iteration
func_lib_setup_kernel_last_timestamp
sleep_count=$(cat /sys/power/wakeup_count)
dlogc "Run the command: rtcwake -m mem -s ${sleep_lst[$i]}"
sudo rtcwake -m mem -s ${sleep_lst[$i]}
[[ $? -ne 0 ]] && die "rtcwake return value error"
dlogc "sleep for ${wait_lst[$i]}"
sleep ${wait_lst[$i]}
dlogi "Check for the kernel log status"
wake_count=$(cat /sys/power/wakeup_count)
# sof-kernel-log-check script parameter number is 0/Non-Number will force check from dmesg
sof-kernel-log-check.sh 0 || die "Catch error in dmesg"
# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh "$KERNEL_LAST_TIMESTAMP" || die "Catch error in kernel log"
# check wakeup count correct
[[ $wake_count -le $sleep_count ]] && die "suspend/resume didn't happen, because /sys/power/wakeup_count does not increase"
wake_count=$(cat /sys/power/wakeup_count)
dlogi "Check for the wakeup_count"
[[ $wake_count -gt $sleep_count ]] || die "suspend/resume didn't happen, because /sys/power/wakeup_count does not increase"
done

# check full log
sof-kernel-log-check.sh $KERNEL_LAST_LINE
exit $?
Loading