Skip to content

Commit c4e5cc6

Browse files
author
Wanzhuo.Li
committed
pause-release-suspend-resume: Parse audio parameters for each pipeline
This patch allows user to specify an input tplg file. Then the test case will call func_pipeline_parse_value to automatically obtain pipeline parameters from the tplg file. User no longer needs to use parameter to specify each pipeline parameters. change the option from -p to -S to align with case check-pause-resume.sh that uses -S to specify PCM ID. Signed-off-by: Wanzhuo.Li <wanzhuox.li@intel.com>
1 parent f581a64 commit c4e5cc6

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

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

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ set -e
77
## Preconditions:
88
## N/A
99
## Description:
10+
## Get audio stream pipeline paremeters from the tplg file.
1011
## test audio stream (playback or capture) with pause/release as well as suspend/resume
1112
## fake pause/release with expect on audio stream process
1213
## have system enter suspend state for 5 secs
1314
## resume from suspend state
1415
## release audio stream from paused state
15-
## repeat
1616
## Case step:
1717
## 1. audio stream process is started
1818
## 2. audio stream process is then paused via mock spacebar press via expect
@@ -56,17 +56,8 @@ source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
5656
OPT_NAME['m']='mode' OPT_DESC['m']='test mode. Example: playback; capture'
5757
OPT_HAS_ARG['m']=1 OPT_VAL['m']='playback'
5858

59-
OPT_NAME['p']='pcm' OPT_DESC['p']='audio pcm. Example: hw:0,0'
60-
OPT_HAS_ARG['p']=1 OPT_VAL['p']='hw:0,0'
61-
62-
OPT_NAME['f']='fmt' OPT_DESC['f']='audio format value'
63-
OPT_HAS_ARG['f']=1 OPT_VAL['f']='S16_LE'
64-
65-
OPT_NAME['c']='channel' OPT_DESC['c']='audio channel count'
66-
OPT_HAS_ARG['c']=1 OPT_VAL['c']='2'
67-
68-
OPT_NAME['r']='rate' OPT_DESC['r']='audio rate'
69-
OPT_HAS_ARG['r']=1 OPT_VAL['r']='48000'
59+
OPT_NAME['S']='filter_string' OPT_DESC['S']='run this case on specified pipelines'
60+
OPT_HAS_ARG['S']=1 OPT_VAL['S']='id:any'
7061

7162
OPT_NAME['F']='file' OPT_DESC['F']='file name. Example: /dev/zero; /dev/null'
7263
OPT_HAS_ARG['F']=1 OPT_VAL['F']=''
@@ -80,16 +71,16 @@ OPT_HAS_ARG['i']=1 OPT_VAL['i']='500'
8071
OPT_NAME['s']='sof-logger' OPT_DESC['s']="Open sof-logger trace the data will store at $LOG_ROOT"
8172
OPT_HAS_ARG['s']=0 OPT_VAL['s']=1
8273

74+
OPT_NAME['t']='tplg' OPT_DESC['t']='tplg file, default value is env TPLG: $TPLG'
75+
OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG"
76+
8377
func_opt_parse_option "$@"
8478

85-
pcm=${OPT_VAL['p']}
86-
fmt=${OPT_VAL['f']}
87-
channel=${OPT_VAL['c']}
88-
rate=${OPT_VAL['r']}
8979
repeat_count=${OPT_VAL['l']}
9080
sleep_period=${OPT_VAL['i']}
9181
test_mode=${OPT_VAL['m']}
9282
file_name=${OPT_VAL['F']}
83+
tplg=${OPT_VAL['t']}
9384

9485
case $test_mode in
9586
"playback")
@@ -107,7 +98,6 @@ esac
10798

10899
[[ -z $file_name ]] && file_name=$dummy_file
109100

110-
111101
logger_disabled || func_lib_start_log_collect
112102

113103
setup_kernel_check_point
@@ -122,7 +112,16 @@ rm -rf /tmp/sof-test.lock
122112
# after ms: Ms must be an integer giving a time in milliseconds.
123113
# The command sleeps for ms milliseconds and then returns.
124114
expect <<AUDIO
125-
spawn $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q
115+
116+
func_pipeline_export "$tplg" "type:$test_mode & ${OPT_VAL['S']}"
117+
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)
123+
124+
spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q
126125
set i 1
127126
set sleep_t $sleep_period
128127
expect {

0 commit comments

Comments
 (0)