1313# # have system enter suspend state for 5 secs
1414# # resume from suspend state
1515# # release audio stream from paused state
16+ # # repeat to all pipelines
17+ # # user can use -S option to specify only one PCM to test also.
1618# # Case step:
1719# # 1. audio stream process is started
1820# # 2. audio stream process is then paused via mock spacebar press via expect
5153# # * No unexpected errors should be present in dmesg during or after test
5254# # completion.
5355
54- source $( dirname ${BASH_SOURCE[0]} ) /../case-lib/lib.sh
56+ CASEDIR=$( dirname " ${BASH_SOURCE[0]} " )
57+ source $CASEDIR /../case-lib/lib.sh
5558
5659OPT_NAME[' m' ]=' mode' OPT_DESC[' m' ]=' test mode. Example: playback; capture'
5760OPT_HAS_ARG[' m' ]=1 OPT_VAL[' m' ]=' playback'
@@ -102,24 +105,24 @@ logger_disabled || func_lib_start_log_collect
102105
103106setup_kernel_check_point
104107
105- dlogi " Entering audio stream expect script with: $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q"
106- dlogi " Will enter suspend-resume cycle during paused period of audio stream process"
107-
108- rm -rf /tmp/sof-test.lock
108+ func_pipeline_export " $tplg " " type:$test_mode & ${OPT_VAL['S']} "
109109
110- # expect is tcl language script
111- # catch: Evaluate script and trap exceptional returns
112- # after ms: Ms must be an integer giving a time in milliseconds.
113- # The command sleeps for ms milliseconds and then returns.
114- expect << AUDIO
110+ for idx in $( seq 0 $( expr $PIPELINE_COUNT - 1) )
111+ do
112+ channel=$( func_pipeline_parse_value " $idx " channel)
113+ rate=$( func_pipeline_parse_value " $idx " rate)
114+ fmt=$( func_pipeline_parse_value " $idx " fmt)
115+ dev=$( func_pipeline_parse_value " $idx " dev)
115116
116- func_pipeline_export "$tplg " "type:$test_mode & ${OPT_VAL['S']} "
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"
117120
118- channel= $( func_pipeline_parse_value " $idx " channel )
119- rate= $( func_pipeline_parse_value " $idx " rate )
120- fmt= $( func_pipeline_parse_value " $idx " fmt )
121- dev= $( func_pipeline_parse_value " $idx " dev )
122- 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
123126
124127spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q
125128set i 1
@@ -128,7 +131,7 @@ expect {
128131 "#*+*\%" {
129132 #audio stream (aplay or arecord) is active now and playing
130133 puts "\r===== (\$ i/$repeat_count ) pb_pbm: Pause $cmd , then wait for ===== "
131- 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"
132135 send " "
133136 after \$ sleep_t
134137 puts "Finished sleep. Confirming $cmd is paused."
@@ -145,7 +148,7 @@ expect {
145148 }
146149
147150 #enter suspend-resume cycle once per pause instance
148- 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]
149152
150153 #prints logs from suspend-resume test
151154 puts \$ msg
@@ -171,13 +174,14 @@ expect {
171174}
172175AUDIO
173176
174- ret=$?
175- # flush the output
176- echo
177- if [ $ret -ne 0 ]; then
178- sof-process-kill.sh
179- [[ $? -ne 0 ]] && dlogw " Kill process catch error"
180- exit $ret
181- fi
182- sof-kernel-log-check.sh " $KERNEL_CHECKPOINT "
183- 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+
187+ done
0 commit comments