Skip to content

Commit 78953be

Browse files
author
Wanzhuo.Li
committed
pause-release-suspend-resume: Automatically test all PCMs
This case will test all PCMs by default. And user can also use the -S option to specify only one PCM to test . Signed-off-by: Wanzhuo.Li <wanzhuox.li@intel.com>
1 parent 2b9ab9e commit 78953be

1 file changed

Lines changed: 32 additions & 30 deletions

File tree

test-case/check-pause-release-suspend-resume.sh

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ set -e
5252
## * No unexpected errors should be present in dmesg during or after test
5353
## completion.
5454

55-
source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
55+
CASEDIR=$(dirname "${BASH_SOURCE[0]}")
56+
source $CASEDIR/../case-lib/lib.sh
5657

5758
OPT_NAME['m']='mode' OPT_DESC['m']='test mode. Example: playback; capture'
5859
OPT_HAS_ARG['m']=1 OPT_VAL['m']='playback'
5960

60-
OPT_NAME['p']='pcm' OPT_DESC['p']='run test case on specified pipelines'
61-
OPT_HAS_ARG['p']=1 OPT_VAL['p']='id:any'
61+
OPT_NAME['S']='pcm' OPT_DESC['S']='run test case on specified pipelines'
62+
OPT_HAS_ARG['S']=1 OPT_VAL['S']='id:any'
6263

6364
OPT_NAME['F']='file' OPT_DESC['F']='file name. Example: /dev/zero; /dev/null'
6465
OPT_HAS_ARG['F']=1 OPT_VAL['F']=''
@@ -103,24 +104,25 @@ logger_disabled || func_lib_start_log_collect
103104

104105
setup_kernel_check_point
105106

106-
dlogi "Entering audio stream expect script with: $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q"
107-
dlogi "Will enter suspend-resume cycle during paused period of audio stream process"
107+
func_pipeline_export "$tplg" "type:$test_mode & ${OPT_VAL['S']}"
108108

109-
rm -rf /tmp/sof-test.lock
109+
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
110+
do
111+
channel=$(func_pipeline_parse_value "$idx" channel)
112+
rate=$(func_pipeline_parse_value "$idx" rate)
113+
fmt=$(func_pipeline_parse_value "$idx" fmt)
114+
dev=$(func_pipeline_parse_value "$idx" dev)
115+
snd=$(func_pipeline_parse_value "$idx" snd)
110116

111-
# expect is tcl language script
112-
# catch: Evaluate script and trap exceptional returns
113-
# after ms: Ms must be an integer giving a time in milliseconds.
114-
# The command sleeps for ms milliseconds and then returns.
115-
expect <<AUDIO
117+
dlogi "Entering audio stream expect script with:
118+
$cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q"
119+
dlogi "Will enter suspend-resume cycle during paused period of audio stream process"
116120

117-
func_pipeline_export "$tplg" "type:$test_mode & ${OPT_VAL['p']}"
118-
119-
channel=$(func_pipeline_parse_value "$idx" channel)
120-
rate=$(func_pipeline_parse_value "$idx" rate)
121-
fmt=$(func_pipeline_parse_value "$idx" fmt)
122-
dev=$(func_pipeline_parse_value "$idx" dev)
123-
snd=$(func_pipeline_parse_value "$idx" snd)
121+
# expect is tcl language script
122+
# catch: Evaluate script and trap exceptional returns
123+
# after ms: Ms must be an integer giving a time in milliseconds.
124+
# The command sleeps for ms milliseconds and then returns.
125+
expect <<AUDIO
124126
125127
spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q
126128
set i 1
@@ -129,7 +131,7 @@ expect {
129131
"#*+*\%" {
130132
#audio stream (aplay or arecord) is active now and playing
131133
puts "\r===== (\$i/$repeat_count) pb_pbm: Pause $cmd, then wait for ===== "
132-
puts "\r(\$i/$repeat_count) pb_pbm: $sleep_t ms after pause"
134+
puts "\r(\$i/$repeat_count) pb_pbm: \$sleep_t ms after pause"
133135
send " "
134136
after \$sleep_t
135137
puts "Finished sleep. Confirming $cmd is paused."
@@ -146,7 +148,7 @@ expect {
146148
}
147149
148150
#enter suspend-resume cycle once per pause instance
149-
set retval [catch { exec bash check-suspend-resume.sh -l 1 } msg]
151+
set retval [catch { exec bash $CASEDIR/check-suspend-resume.sh -l 1 } msg]
150152
151153
#prints logs from suspend-resume test
152154
puts \$msg
@@ -172,13 +174,13 @@ expect {
172174
}
173175
AUDIO
174176

175-
ret=$?
176-
#flush the output
177-
echo
178-
if [ $ret -ne 0 ]; then
179-
sof-process-kill.sh
180-
[[ $? -ne 0 ]] && dlogw "Kill process catch error"
181-
exit $ret
182-
fi
183-
sof-kernel-log-check.sh "$KERNEL_CHECKPOINT"
184-
exit $?
177+
ret=$?
178+
#flush the output
179+
echo
180+
if [ $ret -ne 0 ]; then
181+
sof-process-kill.sh
182+
[[ $? -ne 0 ]] && dlogw "Kill process catch error"
183+
exit $ret
184+
fi
185+
sof-kernel-log-check.sh "$KERNEL_CHECKPOINT" || die "Caught error in kernel log"
186+
done

0 commit comments

Comments
 (0)