Skip to content

Commit c1b41f4

Browse files
committed
TinyALSA:Refactor check-capture and check-playback
Refactor Check-capture and Check-playback tests. Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
1 parent 07e77bb commit c1b41f4

File tree

2 files changed

+16
-26
lines changed

2 files changed

+16
-26
lines changed

test-case/check-capture.sh

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,38 +64,33 @@ setup_kernel_check_point
6464
func_lib_check_sudo
6565
func_pipeline_export "$tplg" "type:capture & ${OPT_VAL['S']}"
6666

67-
for round in $(seq 1 $round_cnt)
67+
for round in $(seq 1 "$round_cnt")
6868
do
6969
for idx in $(seq 0 $((PIPELINE_COUNT - 1)))
7070
do
71-
channel=$(func_pipeline_parse_value "$idx" channel)
72-
rate=$(func_pipeline_parse_value "$idx" rate)
73-
fmt=$(func_pipeline_parse_value "$idx" fmt)
74-
dev=$(func_pipeline_parse_value "$idx" dev)
75-
pcm=$(func_pipeline_parse_value "$idx" pcm)
76-
type=$(func_pipeline_parse_value "$idx" type)
77-
snd=$(func_pipeline_parse_value "$idx" snd)
78-
79-
if [ ${OPT_VAL['F']} = '1' ]; then
80-
fmt=$(func_pipeline_parse_value "$idx" fmts)
71+
72+
initialize_audio_params "$idx"
73+
74+
if [ "${OPT_VAL['F']}" = '1' ]; then
75+
fmts=$(func_pipeline_parse_value "$idx" fmts)
8176
fi
8277

83-
for fmt_elem in $fmt
78+
for fmt_elem in $fmts
8479
do
85-
for i in $(seq 1 $loop_cnt)
80+
for i in $(seq 1 "$loop_cnt")
8681
do
8782
dlogi "===== Testing: (Round: $round/$round_cnt) (PCM: $pcm [$dev]<$type>) (Loop: $i/$loop_cnt) ====="
8883
# get the output file
8984
if [[ -z $file_prefix ]]; then
9085
dlogi "no file prefix, use /dev/null as dummy capture output"
9186
file=/dev/null
9287
else
93-
mkdir -p $out_dir
88+
mkdir -p "$out_dir"
9489
file=$out_dir/${file_prefix}_${dev}_${i}.wav
9590
dlogi "using $file as capture output"
9691
fi
9792

98-
if ! arecord_opts -D"$dev" -r "$rate" -c "$channel" -f "$fmt_elem" -d $duration "$file" -v -q;
93+
if ! arecord_opts -D"$dev" -r "$rate" -c "$channel" -f "$fmt_elem" -d "$duration" "$file" -v -q;
9994
then
10095
func_lib_lsof_error_dump "$snd"
10196
die "arecord on PCM $dev failed at $i/$loop_cnt."

test-case/check-playback.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,20 @@ setup_kernel_check_point
7171
func_lib_check_sudo
7272
func_pipeline_export "$tplg" "type:playback & ${OPT_VAL['S']}"
7373

74-
for round in $(seq 1 $round_cnt)
74+
for round in $(seq 1 "$round_cnt")
7575
do
7676
for idx in $(seq 0 $((PIPELINE_COUNT - 1)))
7777
do
78-
channel=$(func_pipeline_parse_value "$idx" channel)
79-
rate=$(func_pipeline_parse_value "$idx" rate)
80-
fmts=$(func_pipeline_parse_value "$idx" fmt)
81-
dev=$(func_pipeline_parse_value "$idx" dev)
82-
pcm=$(func_pipeline_parse_value "$idx" pcm)
83-
type=$(func_pipeline_parse_value "$idx" type)
84-
snd=$(func_pipeline_parse_value "$idx" snd)
85-
86-
if [ ${OPT_VAL['F']} = '1' ]; then
78+
79+
initialize_audio_params "$idx"
80+
81+
if [ "${OPT_VAL['F']}" = '1' ]; then
8782
fmts=$(func_pipeline_parse_value "$idx" fmts)
8883
fi
8984

9085
for fmt_elem in $fmts
9186
do
92-
for i in $(seq 1 $loop_cnt)
87+
for i in $(seq 1 "$loop_cnt")
9388
do
9489
dlogi "===== Testing: (Round: $round/$round_cnt) (PCM: $pcm [$dev]<$type>) (Loop: $i/$loop_cnt) ====="
9590
aplay_opts -D"$dev" -r "$rate" -c "$channel" -f "$fmt_elem" \

0 commit comments

Comments
 (0)