Skip to content
Merged
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
48 changes: 21 additions & 27 deletions test-case/check-fw-echo-reference.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

##
## Case Name: check_echo_reference
## Preconditions:
Expand All @@ -18,15 +20,16 @@
rm -f /tmp/bat.wav.*

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

OPT_OPT_lst['t']='tplg' OPT_DESC_lst['t']='tplg file, default value is env TPLG: $''TPLG'
OPT_PARM_lst['t']=1 OPT_VALUE_lst['t']="$TPLG"
OPT_OPT_lst['t']='tplg' OPT_DESC_lst['t']='tplg file, default value is env TPLG: $''TPLG'
OPT_PARM_lst['t']=1 OPT_VALUE_lst['t']="$TPLG"
OPT_OPT_lst['s']='sof-logger' OPT_DESC_lst['s']="Open sof-logger trace the data will store at $LOG_ROOT"
OPT_PARM_lst['s']=0 OPT_VALUE_lst['s']=1
OPT_OPT_lst['l']='loop' OPT_DESC_lst['l']='loop count'
OPT_PARM_lst['l']=1 OPT_VALUE_lst['l']=1
OPT_OPT_lst['n']='frames' OPT_DESC_lst['n']='test frames'
OPT_OPT_lst['l']='loop' OPT_DESC_lst['l']='loop count'
OPT_PARM_lst['l']=1 OPT_VALUE_lst['l']=1
OPT_OPT_lst['n']='frames' OPT_DESC_lst['n']='test frames'
OPT_PARM_lst['n']=1 OPT_VALUE_lst['n']=240000
OPT_OPT_lst['f']='frequency' OPT_DESC_lst['f']='target frequency'
OPT_PARM_lst['f']=1 OPT_VALUE_lst['f']=997
Expand All @@ -43,23 +46,11 @@ frequency=${OPT_VALUE_lst['f']}
func_pipeline_export $tplg "echo:any"
func_lib_setup_kernel_last_line

function __upload_wav_file
{
# upload the alsabat wav file
for file in /tmp/bat.wav.*
do
size=$(ls -l "$file" | awk '{print $5}')
if [[ $size -gt 0 ]]; then
cp "$file" "$LOG_ROOT/"
fi
done
}

if [ "$PIPELINE_COUNT" != "2" ]; then
die "Only detect $PIPELINE_COUNT pipeline(s) from topology, but two are needed"
fi

for idx in $(seq 0 $(("$PIPELINE_COUNT" - 1)))
for idx in $(seq 0 $((PIPELINE_COUNT - 1)))
do
type=$(func_pipeline_parse_value "$idx" type)
if [ "$type" == "playback" ]; then
Expand All @@ -80,21 +71,24 @@ do
printf "Testing: iteration %d of %d with %s format\n" "$i" "$loop_cnt" "$fmt"
# S24_LE format is not supported
if [ "$fmt" == "S24_LE" ]; then
dlogi "S24_LE is not supported, skip to test this format"
continue
fi

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this print a warning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

# run echo reference test
dlogc "alsabat -P $pb_dev --standalone -c $channel -f $fmt -r $rate -n $frames -F $frequency"
alsabat -P "$pb_dev" --standalone -c "$channel" -f "$fmt" -r "$rate" -n "$frames" -F "$frequency" &
# playback may have low latency, add 0.5 second delay to aviod recording zero at beginning.
timeout -k 2 6 alsabat -P "$pb_dev" --standalone -c "$channel" -f "$fmt" -r "$rate" -n "$frames" \
-F "$frequency" & alsabatPID=$!
# playback may have low latency, add 1 second delay to aviod recording zero at beginning.
sleep 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says 0.5 but the code says 1.
Did you mean "high" latency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be 1 second delay.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

dlogc "alsabat -C $cp_dev -c $channel -f $fmt -r $rate -F $frequency"
alsabat -C "$cp_dev" -c "$channel" -f "$fmt" -r "$rate" -F "$frequency"
alsabat -C "$cp_dev" -c "$channel" -f "$fmt" -r "$rate" -F "$frequency" || {
# upload failed wav files
find /tmp -maxdepth 1 -type f -name "bat.wav.*" -size +0 -exec cp {} "$LOG_ROOT/" \;
Comment thread
aiChaoSONG marked this conversation as resolved.
die "alsabat test failed on pcm: $cp_dev"
}

wait $alsabatPID || die "Failed to stop alsabat playback"

# upload failed wav file
if [[ "$?" != "0" ]]; then
__upload_wav_file
exit 1
fi
sleep 2 # 2 seconds interval for next run
done
done
Expand Down