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
34 changes: 19 additions & 15 deletions test-case/check-pause-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ set -e
## no error happen for aplay/arecord
##

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['t']='tplg' OPT_DESC_lst['t']='tplg file, default value is env TPLG: $TPLG'
OPT_OPT_lst['t']='tplg' OPT_DESC_lst['t']='tplg file, default value is env TPLG: $''TPLG'
OPT_PARM_lst['t']=1 OPT_VALUE_lst['t']="$TPLG"

OPT_OPT_lst['m']='mode' OPT_DESC_lst['m']='test mode'
Expand Down Expand Up @@ -53,16 +54,18 @@ file_name=${OPT_VALUE_lst['f']}
# configure random value range
rnd_min=${OPT_VALUE_lst['i']}
rnd_max=${OPT_VALUE_lst['a']}
rnd_range=$[ $rnd_max - $rnd_min ]
rnd_range=$(( rnd_max - rnd_min ))
[[ $rnd_range -le 0 ]] && dlogw "Error random range scope [ min:$rnd_min - max:$rnd_max ]" && exit 2

case $test_mode in
"playback")
cmd=aplay
cmd_opts="$SOF_APLAY_OPTS"
dummy_file=/dev/zero
;;
"capture")
cmd=arecord
cmd_opts="$SOF_ARECORD_OPTS"
dummy_file=/dev/null
;;
*)
Expand All @@ -75,24 +78,25 @@ esac
[[ -z $file_name ]] && file_name=$dummy_file

func_pipeline_export "$tplg" "type:$test_mode & ${OPT_VALUE_lst['S']}"
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
for idx in $(seq 0 $((PIPELINE_COUNT - 1)))
do
# set up checkpoint for each iteration
func_lib_setup_kernel_checkpoint
channel=$(func_pipeline_parse_value $idx channel)
rate=$(func_pipeline_parse_value $idx rate)
fmt=$(func_pipeline_parse_value $idx fmt)
dev=$(func_pipeline_parse_value $idx dev)
snd=$(func_pipeline_parse_value $idx snd)

dlogi "Entering expect script with: $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q"
channel=$(func_pipeline_parse_value "$idx" channel)
rate=$(func_pipeline_parse_value "$idx" rate)
fmt=$(func_pipeline_parse_value "$idx" fmt)
dev=$(func_pipeline_parse_value "$idx" dev)
snd=$(func_pipeline_parse_value "$idx" snd)

# expect is tcl language script
# expr rand(): produces random numbers between 0 and 1
# after ms: Ms must be an integer giving a time in milliseconds.
# The command sleeps for ms milliseconds and then returns.
dlogi "Entering expect script with:
Comment thread
xiulipan marked this conversation as resolved.
Resolved
$cmd $SOF_ALSA_OPTS $cmd_opts -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q"

expect <<END
spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q
spawn $cmd $SOF_ALSA_OPTS $cmd_opts -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q
set i 1
expect {
"*#*+*\%" {
Expand All @@ -118,9 +122,9 @@ END
#flush the output
echo
if [ $ret -ne 0 ]; then
func_lib_lsof_error_dump $snd
sof-process-kill.sh
[[ $? -ne 0 ]] && dlogw "Kill process catch error"
func_lib_lsof_error_dump "$snd"
sof-process-kill.sh ||
dlogw "Kill process catch error"
exit $ret
fi
# check kernel log for each iteration to catch issues
Expand Down