Skip to content
Merged
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
32 changes: 13 additions & 19 deletions test-case/check-kmod-load-unload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
## check kernel log and find no errors
##

source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
# shellcheck source=case-lib/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh

OPT_OPT_lst['l']='loop_cnt'
OPT_DESC_lst['l']='remove / insert module loop count -- per device'
Expand All @@ -33,12 +34,9 @@ func_opt_parse_option "$@"
func_lib_setup_kernel_last_line

loop_cnt=${OPT_VALUE_lst['l']}
usb_audio_module="snd_usb_audio"
kern_log="/var/log/kern.log"
keyword_info=""

PATH="${PATH%%:*}/kmod:$PATH"
func_lib_check_sudo
func_lib_check_sudo 'unloading modules'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is required to avoid a warning once #369 is merged.


if [ ${OPT_VALUE_lst['p']} -eq 1 ];then
func_lib_disable_pulseaudio
Expand All @@ -65,38 +63,34 @@ do
fi
[[ $(sof-dump-status.py --dsp_status 0) == "suspended" ]] && break
sleep 1
if [ $i -eq 15 ]; then
if [ "$i" -eq 15 ]; then
die "dsp is not suspended after 15s, end test"
fi
done

dlogi "run kmod/sof-kmod-remove.sh"
sudo sof_remove.sh
[[ $? -ne 0 ]] && die "remove modules error"
sudo sof_remove.sh || die "remove modules error"

## - 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
if [[ $? -ne 0 ]]; then
sof-kernel-log-check.sh "$KERNEL_LAST_LINE" ||
die "error found after kmod unload is real error, failing"
fi

func_lib_setup_kernel_last_line
dlogi "run kmod/sof_insert.sh"
sudo sof_insert.sh
[[ $? -ne 0 ]] && dloge "insert modules error" && exit
sleep 1
sudo sof_insert.sh || {
# FIXME: don't exit the status of dloge(). Use die()
dloge "insert modules error" && exit
}

## - 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
if [[ $? -ne 0 ]]; then
sof-kernel-log-check.sh "$KERNEL_LAST_LINE" ||
die "Found error(s) in kernel log after module insertion"
fi

dlogi "checking if firmware is loaded successfully"
$(dirname ${BASH_SOURCE[0]})/verify-sof-firmware-load.sh > /dev/null
[[ $? -ne 0 ]] && die "Failed to load firmware after module insertion"
"$(dirname "${BASH_SOURCE[0]}")"/verify-sof-firmware-load.sh > /dev/null ||
die "Failed to load firmware after module insertion"

# successful remove/insert module pass
dlogi "==== firmware boot complete: $idx of $loop_cnt ===="
Expand Down