Skip to content

Commit

Permalink
check-suspend-resume: check process id in each loop for audio test case
Browse files Browse the repository at this point in the history
check-suspend-resume-with-audio.sh uses check-suspend-resume.sh.
process check is in check-suspend-resume-with-audio.sh and
check-suspend-resume.sh has the loop. Must check that the process id
is available in each loop. TO do so, pass aplay/arecord pid to
check-suspend-resume.sh.

Signed-off-by: Fred Oh <[email protected]>
  • Loading branch information
fredoh9 committed Jul 25, 2024
1 parent 11b9bbc commit 9bc74c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test-case/check-suspend-resume-with-audio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ do
ps --ppid $$ -f
exit 1
}
"${TESTDIR}"/check-suspend-resume.sh "${opt_arr[@]}" || die "suspend resume failed"
# Pass -p $process_id option to check-suspend-resume.sh
suspend_opts=("${opt_arr[@]}" -p "$process_id")
"${TESTDIR}"/check-suspend-resume.sh "${suspend_opts[@]}" || die "suspend resume failed"

# check kernel log for each iteration to catch issues
sof-kernel-log-check.sh "$LOCAL_CHECK_POINT" || die "Caught error in kernel log"
Expand Down
15 changes: 15 additions & 0 deletions test-case/check-suspend-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ OPT_HAS_ARG['w']=1 OPT_VAL['w']=5
OPT_NAME['r']='random' OPT_DESC['r']="Randomly setup wait/sleep time, range is [$random_min-$random_max], this option will overwrite s & w option"
OPT_HAS_ARG['r']=0 OPT_VAL['r']=0

# processid is set by check-suspend-resume-with-audio.sh for audio test case
OPT_NAME['p']='processid' OPT_DESC['p']='Fail immediately if this process dies'
OPT_HAS_ARG['p']=1 OPT_VAL['p']=''

func_opt_parse_option "$@"
func_lib_check_sudo

Expand Down Expand Up @@ -196,6 +200,17 @@ sleep_once()
[ "$stats_success" -eq "$expected_stats_success" ] ||
dump_and_die "/sys/power/suspend_stats/success is $stats_success, expected $expected_stats_success"
check_suspend_fails || dump_and_die "some failure counts have changed"

# if OPT_VAL['p'] has process id, then check the process id is available in the system
if [ "${OPT_VAL['p']}" ]; then
dlogi "Check for the process status, pid: ${OPT_VAL['p']}"
sof-process-state.sh "${OPT_VAL['p']}" || {
dloge "process status is abnormal, pid: ${OPT_VAL['p']}"
dlogi "dump ps for child process"
ps --ppid $$ -f
exit 1
}
fi
}

main "$@"

0 comments on commit 9bc74c8

Please sign in to comment.