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
38 changes: 20 additions & 18 deletions test-case/multiple-pipeline-capture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ func_run_pipeline_with_type()
func_error_exit()
{
dloge "$*"
pgrep -a aplay
pgrep -a arecord
pkill -9 aplay
pkill -9 arecord
( set +e
pgrep -a aplay
pgrep -a arecord
pkill -9 aplay
pkill -9 arecord
)

Choose a reason for hiding this comment

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

how about ! pgrep -a aplay || pkill -9 aplay, I think this should be compatible with set -e. the (set +e ...) looks like some hack.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this a good idea and better code however I don't think it's worth delaying this very urgent fix and I don't think (set +e ...) is a hack at all

Is it enough if I promise to submit a follow up commit with your change ASAP after this?

Choose a reason for hiding this comment

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

@marc-hb sure, this is already good enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

how about ! pgrep -a aplay || pkill -9 aplay

#523

exit 1
}

Expand All @@ -119,41 +121,41 @@ do

# check all refer capture pipeline status
# 1. check process count:
pcount=$(pidof arecord|wc -w)
tmp_count=$((tmp_count + pcount))
pcount=$(pidof aplay|wc -w)
tmp_count=$((tmp_count + pcount))
rec_count=$(pidof arecord|wc -w)
tmp_count=$((tmp_count + rec_count))
play_count=$(pidof aplay|wc -w)
tmp_count=$((tmp_count + play_count))
[[ $tmp_count -ne $max_count ]] && func_error_exit "Target pipeline count: $max_count, current process count: $tmp_count"

# 2. check arecord process status
dlogi "checking pipeline status"
sof-process-state.sh arecord >/dev/null ||
[ "$rec_count" = 0 ] || sof-process-state.sh arecord >/dev/null ||
func_error_exit "Catch the abnormal process status of arecord"
sof-process-state.sh aplay >/dev/null ||
[ "$play_count" = 0 ] || sof-process-state.sh aplay >/dev/null ||
func_error_exit "Catch the abnormal process status of aplay"

dlogi "preparing sleep ${OPT_VALUE_lst['w']}"
sleep ${OPT_VALUE_lst['w']}

# 3. check process count again:
tmp_count=0
pcount=$(pidof arecord|wc -w)
tmp_count=$((tmp_count + pcount))
pcount=$(pidof aplay|wc -w)
tmp_count=$((tmp_count + pcount))
rec_count=$(pidof arecord|wc -w)
tmp_count=$((tmp_count + rec_count))
play_count=$(pidof aplay|wc -w)
tmp_count=$((tmp_count + play_count))
[[ $tmp_count -ne $max_count ]] && func_error_exit "Target pipeline count: $max_count, current process count: $tmp_count"

# 4. check arecord process status
dlogi "checking pipeline status again"
sof-process-state.sh arecord >/dev/null ||
[ "$rec_count" = 0 ] || sof-process-state.sh arecord >/dev/null ||
func_error_exit "Catch the abnormal process status of arecord"
sof-process-state.sh aplay >/dev/null ||
[ "$play_count" = 0 ] || sof-process-state.sh aplay >/dev/null ||
func_error_exit "Catch the abnormal process status of aplay"


dlogc 'pkill -9 aplay arecord'
pkill -9 arecord
pkill -9 aplay
[ "$rec_count" = 0 ] || pkill -9 arecord
[ "$play_count" = 0 ] || pkill -9 aplay

sof-kernel-log-check.sh 0 || die "Catch error in dmesg"
done
Expand Down