Skip to content

Commit

Permalink
pause-release-suspend-resume: Parse audio parameters for each pipeline
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wanzhuo.Li committed Sep 9, 2021
1 parent 3c17dc2 commit 2b9ab9e
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions test-case/check-pause-release-suspend-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -e
## Preconditions:
## N/A
## Description:
## Get audio stream pipeline paremeters from the tplg file.
## test audio stream (playback or capture) with pause/release as well as suspend/resume
## fake pause/release with expect on audio stream process
## have system enter suspend state for 5 secs
Expand Down Expand Up @@ -56,17 +57,8 @@ source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
OPT_NAME['m']='mode' OPT_DESC['m']='test mode. Example: playback; capture'
OPT_HAS_ARG['m']=1 OPT_VAL['m']='playback'

OPT_NAME['p']='pcm' OPT_DESC['p']='audio pcm. Example: hw:0,0'
OPT_HAS_ARG['p']=1 OPT_VAL['p']='hw:0,0'

OPT_NAME['f']='fmt' OPT_DESC['f']='audio format value'
OPT_HAS_ARG['f']=1 OPT_VAL['f']='S16_LE'

OPT_NAME['c']='channel' OPT_DESC['c']='audio channel count'
OPT_HAS_ARG['c']=1 OPT_VAL['c']='2'

OPT_NAME['r']='rate' OPT_DESC['r']='audio rate'
OPT_HAS_ARG['r']=1 OPT_VAL['r']='48000'
OPT_NAME['p']='pcm' OPT_DESC['p']='run test case on specified pipelines'
OPT_HAS_ARG['p']=1 OPT_VAL['p']='id:any'

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

OPT_NAME['t']='tplg' OPT_DESC['t']='tplg file, default value is env TPLG: $TPLG'
OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG"

func_opt_parse_option "$@"

pcm=${OPT_VAL['p']}
fmt=${OPT_VAL['f']}
channel=${OPT_VAL['c']}
rate=${OPT_VAL['r']}
repeat_count=${OPT_VAL['l']}
sleep_period=${OPT_VAL['i']}
test_mode=${OPT_VAL['m']}
file_name=${OPT_VAL['F']}
tplg=${OPT_VAL['t']}

case $test_mode in
"playback")
Expand All @@ -107,7 +99,6 @@ esac

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


logger_disabled || func_lib_start_log_collect

setup_kernel_check_point
Expand All @@ -122,7 +113,16 @@ rm -rf /tmp/sof-test.lock
# after ms: Ms must be an integer giving a time in milliseconds.
# The command sleeps for ms milliseconds and then returns.
expect <<AUDIO
spawn $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q
func_pipeline_export "$tplg" "type:$test_mode & ${OPT_VAL['p']}"
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)
spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q
set i 1
set sleep_t $sleep_period
expect {
Expand Down

0 comments on commit 2b9ab9e

Please sign in to comment.