Skip to content

Commit

Permalink
test-case: add more error handling for check-performance
Browse files Browse the repository at this point in the history
The error won't be reported if process exit unexpectedly,
add error handling code for this.

Signed-off-by: Chao Song <[email protected]>
  • Loading branch information
Chao Song authored and keqiaozhang committed Aug 29, 2023
1 parent 7e70d7d commit ea41d63
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test-case/check-performance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ setup_kernel_check_point
func_lib_check_sudo
func_pipeline_export "$tplg" "type:any"

aplay_num=0
arecord_num=0

for idx in $(seq 0 $((PIPELINE_COUNT - 1)))
do
channel=$(func_pipeline_parse_value "$idx" channel)
Expand All @@ -62,11 +65,24 @@ do
dlogi "Running (PCM: $pcm [$dev]<$type>) in background"
if [ "$type" == "playback" ]; then
aplay_opts -D "$dev" -c "$channel" -r "$rate" -f "$fmt" -d "$duration" /dev/zero -q &
aplay_num=$((aplay_num+1))
else
arecord_opts -D "$dev" -c "$channel" -r "$rate" -f "$fmt" -d "$duration" /dev/null -q &
arecord_num=$((arecord_num+1))
fi
done

sleep 1 # waiting stable streaming of aplay/arecord
dlogi "Number of aplay/arecord process started: $aplay_num, $arecord_num"

real_aplay_num=$(ps --no-headers -C aplay | wc -l)
real_arecord_num=$(ps --no-headers -C arecord | wc -l)
if [ "$real_aplay_num" != "$aplay_num" ] || [ "$real_arecord_num" != "$arecord_num" ];
then
dlogi "Number of aplay/arecord process running: $real_aplay_num, $real_arecord_num"
die "aplay/arecord process exit unexpectedly"
fi

dlogi "Waiting for aplay/arecord process to exit"
sleep $((duration + 2))

Expand Down

0 comments on commit ea41d63

Please sign in to comment.