Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion test-case/check-alsabat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
rm -f /tmp/bat.wav.*

# shellcheck source=case-lib/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh
TESTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
source "$TESTDIR/case-lib/lib.sh"

OPT_NAME['p']='pcm_p' OPT_DESC['p']='pcm for playback. Example: hw:0,0'
OPT_HAS_ARG['p']=1 OPT_VAL['p']=''
Expand Down Expand Up @@ -48,6 +49,9 @@ OPT_HAS_ARG['n']=1 OPT_VAL['n']=240000
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['q']='min_snr' OPT_DESC['q']='Mininimum SNR value dB to pass test, recommend 80 for high quality DUT'
OPT_HAS_ARG['q']=1 OPT_VAL['q']=46

func_opt_parse_option "$@"
setup_kernel_check_point

Expand All @@ -59,6 +63,7 @@ format=${OPT_VAL['f']}
frequency=${OPT_VAL['F']}
sigmak=${OPT_VAL['k']}
frames=${OPT_VAL['n']}
min_snr=${OPT_VAL['q']}

if [ "$pcm_p" = "" ]||[ "$pcm_c" = "" ];
then
Expand Down Expand Up @@ -95,6 +100,20 @@ function __upload_wav_file
done
}

function check_wav_file_snr
{
for file in /tmp/bat.wav.*
do
if test -s "$file"; then
dlogi "Checking wav file $file"
cd "$TESTDIR"/tools
octave --silent --no-gui --eval "check_wav_file_snr('$file', $frequency, $min_snr, '$LOG_ROOT/');" || {
die "Error: Script check_wav_file_snr.m found issues in $file"
}
fi
done
}

# check the PCMs before alsabat test
dlogi "check the PCMs before alsabat test"
aplay -Dplug$pcm_p -d 1 /dev/zero -q || die "Failed to play on PCM: $pcm_p"
Expand All @@ -119,4 +138,6 @@ alsabat -C$pcm_c -c $channel_c -r $rate -f $format -F $frequency -k $sigmak || {
exit 1
}

check_wav_file_snr

wait $playPID
Loading