From f581a64ee3214fc7204b2727cefb744c2ad1245f Mon Sep 17 00:00:00 2001 From: "Wanzhuo.Li" Date: Fri, 10 Sep 2021 10:35:19 +0800 Subject: [PATCH 1/3] pause-release-suspend-resume: Extend the sleep time to 500ms On some platforms, 100ms is not enough to detect whether the audio thread has entered the pause state. This patch extends the sleep time to 500ms after pause Signed-off-by: Wanzhuo.Li --- test-case/check-pause-release-suspend-resume.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-case/check-pause-release-suspend-resume.sh b/test-case/check-pause-release-suspend-resume.sh index 1494948c..a728477c 100755 --- a/test-case/check-pause-release-suspend-resume.sh +++ b/test-case/check-pause-release-suspend-resume.sh @@ -75,7 +75,7 @@ OPT_NAME['l']='loop' OPT_DESC['l']='loop count' OPT_HAS_ARG['l']=1 OPT_VAL['l']=5 OPT_NAME['i']='sleep-period' OPT_DESC['i']='sleep period of aplay, unit is ms' -OPT_HAS_ARG['i']=1 OPT_VAL['i']='100' +OPT_HAS_ARG['i']=1 OPT_VAL['i']='500' 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 From b35f4db7fa45315f37d0da2e9e509019b784e46f Mon Sep 17 00:00:00 2001 From: "Wanzhuo.Li" Date: Wed, 15 Sep 2021 12:05:16 +0800 Subject: [PATCH 2/3] pause-release-suspend-resume: Parse audio parameters and test 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. This case will test all PCMs by default. Signed-off-by: Wanzhuo.Li --- .../check-pause-release-suspend-resume.sh | 86 ++++++++++--------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/test-case/check-pause-release-suspend-resume.sh b/test-case/check-pause-release-suspend-resume.sh index a728477c..16c8625f 100755 --- a/test-case/check-pause-release-suspend-resume.sh +++ b/test-case/check-pause-release-suspend-resume.sh @@ -7,12 +7,14 @@ set -e ## Preconditions: ## N/A ## Description: -## test audio stream (playback or capture) with pause/release as well as suspend/resume -## fake pause/release with expect on audio stream process +## Get audio stream pipeline paremeters from the tplg file. +## test audio stream (playback or capture) with pause as well as suspend/resume +## fake pause with expect on audio stream process ## have system enter suspend state for 5 secs ## resume from suspend state ## release audio stream from paused state -## repeat +## repeat to all pipelines +## user can use -S option to specify only one PCM to test also. ## Case step: ## 1. audio stream process is started ## 2. audio stream process is then paused via mock spacebar press via expect @@ -51,22 +53,16 @@ set -e ## * No unexpected errors should be present in dmesg during or after test ## completion. -source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh +CASEDIR=$(dirname "${BASH_SOURCE[0]}") + +# shellcheck source=case-lib/lib.sh +source "$CASEDIR"/../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['S']='filter_string' OPT_DESC['S']='run this case on specified pipelines' +OPT_HAS_ARG['S']=1 OPT_VAL['S']='id:any' OPT_NAME['F']='file' OPT_DESC['F']='file name. Example: /dev/zero; /dev/null' OPT_HAS_ARG['F']=1 OPT_VAL['F']='' @@ -80,16 +76,16 @@ OPT_HAS_ARG['i']=1 OPT_VAL['i']='500' 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 with complete path, default is environment variable: 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") @@ -107,29 +103,37 @@ esac [[ -z $file_name ]] && file_name=$dummy_file - logger_disabled || func_lib_start_log_collect setup_kernel_check_point -dlogi "Entering audio stream expect script with: $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q" -dlogi "Will enter suspend-resume cycle during paused period of audio stream process" +func_pipeline_export "$tplg" "type:$test_mode & ${OPT_VAL['S']}" + +for idx in $(seq 0 $((PIPELINE_COUNT - 1))) +do + 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) -rm -rf /tmp/sof-test.lock + dlogi "Entering audio stream expect script with: + $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q" + dlogi "Will enter suspend-resume cycle during paused period of audio stream process" -# expect is tcl language script -# catch: Evaluate script and trap exceptional returns -# after ms: Ms must be an integer giving a time in milliseconds. -# The command sleeps for ms milliseconds and then returns. -expect <