Skip to content

Commit 2b9ab9e

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. Signed-off-by: Wanzhuo.Li <wanzhuox.li@intel.com>
1 parent 3c17dc2 commit 2b9ab9e

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ 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
@@ -56,17 +57,8 @@ source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
5657
OPT_NAME['m']='mode' OPT_DESC['m']='test mode. Example: playback; capture'
5758
OPT_HAS_ARG['m']=1 OPT_VAL['m']='playback'
5859

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'
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'
7062

7163
OPT_NAME['F']='file' OPT_DESC['F']='file name. Example: /dev/zero; /dev/null'
7264
OPT_HAS_ARG['F']=1 OPT_VAL['F']=''
@@ -80,16 +72,16 @@ OPT_HAS_ARG['i']=1 OPT_VAL['i']='200'
8072
OPT_NAME['s']='sof-logger' OPT_DESC['s']="Open sof-logger trace the data will store at $LOG_ROOT"
8173
OPT_HAS_ARG['s']=0 OPT_VAL['s']=1
8274

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

85-
pcm=${OPT_VAL['p']}
86-
fmt=${OPT_VAL['f']}
87-
channel=${OPT_VAL['c']}
88-
rate=${OPT_VAL['r']}
8980
repeat_count=${OPT_VAL['l']}
9081
sleep_period=${OPT_VAL['i']}
9182
test_mode=${OPT_VAL['m']}
9283
file_name=${OPT_VAL['F']}
84+
tplg=${OPT_VAL['t']}
9385

9486
case $test_mode in
9587
"playback")
@@ -107,7 +99,6 @@ esac
10799

108100
[[ -z $file_name ]] && file_name=$dummy_file
109101

110-
111102
logger_disabled || func_lib_start_log_collect
112103

113104
setup_kernel_check_point
@@ -122,7 +113,16 @@ rm -rf /tmp/sof-test.lock
122113
# after ms: Ms must be an integer giving a time in milliseconds.
123114
# The command sleeps for ms milliseconds and then returns.
124115
expect <<AUDIO
125-
spawn $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q
116+
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)
124+
125+
spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q
126126
set i 1
127127
set sleep_t $sleep_period
128128
expect {

0 commit comments

Comments
 (0)