Skip to content

Commit

Permalink
check-suspend-resume-with-audio.sh: Shellcheck pgrep fixes.
Browse files Browse the repository at this point in the history
Replaced ps -ef | grep lines with pgrep.

Rewrote conditional of a sof-process-state.sh line (that was basically broken).
The script had 'set -e' so the command would fail and exit the script.
This prevented the follow-up lines, which were checking exit status ($?), from
ever being run if the command failed.

Removed unused variable assignment pcm).

Signed-off-by: Greg Galloway <greg.galloway@intel.com>
  • Loading branch information
greg-intel authored and marc-hb committed Jun 28, 2023
1 parent 4b98d23 commit 56791a1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test-case/check-suspend-resume-with-audio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ do
rate=$(func_pipeline_parse_value "$idx" rate)
fmt=$(func_pipeline_parse_value "$idx" fmt)
dev=$(func_pipeline_parse_value "$idx" dev)
pcm=$(func_pipeline_parse_value "$idx" pcm)
snd=$(func_pipeline_parse_value "$idx" snd)
dlogi "Run $TYPE command for the background"
cmd_args="$cmd -D$dev -r $rate -c $channel -f $fmt $file_name -q"
Expand All @@ -108,16 +107,15 @@ do
# delay for process run
sleep 1
# check process status is correct
sof-process-state.sh $process_id
if [ $? -ne 0 ]; then
sof-process-state.sh $process_id || {
func_lib_lsof_error_dump "$snd"
dloge "error process state of $cmd"
dlogi "dump ps for aplay & arecord"
ps -ef |grep -E 'aplay|arecord'
pgrep -fla "aplay|arecord"
dlogi "dump ps for child process"
ps --ppid $$ -f
exit 1
fi
}
"$(dirname "${BASH_SOURCE[0]}")"/check-suspend-resume.sh "${opt_arr[@]}" || die "suspend resume failed"

# check kernel log for each iteration to catch issues
Expand All @@ -128,7 +126,7 @@ do
func_lib_lsof_error_dump "$snd"
dloge "process status is abnormal"
dlogi "dump ps for aplay & arecord"
ps -ef |grep -E 'aplay|arecord'
pgrep -fla "aplay|arecord"
dlogi "dump ps for child process"
ps --ppid $$ -f
exit 1
Expand Down

0 comments on commit 56791a1

Please sign in to comment.