diff --git a/test-case/check-suspend-resume-with-audio.sh b/test-case/check-suspend-resume-with-audio.sh index 190b05b6..2460bc4e 100755 --- a/test-case/check-suspend-resume-with-audio.sh +++ b/test-case/check-suspend-resume-with-audio.sh @@ -110,7 +110,7 @@ do # delay for process run sleep 1 # check process status is correct - sof-process-state.sh $process_id || { + sof-process-state.sh "$process_id" || { func_lib_lsof_error_dump "$snd" dloge "error process state of $cmd" dlogi "dump ps for aplay & arecord" @@ -119,6 +119,8 @@ do ps --ppid $$ -f exit 1 } + # Pass -p $process_id option to check-suspend-resume.sh + opt_arr+=(-p "$process_id") "${TESTDIR}"/check-suspend-resume.sh "${opt_arr[@]}" || die "suspend resume failed" # check kernel log for each iteration to catch issues @@ -134,6 +136,10 @@ do ps --ppid $$ -f exit 1 } + # remove -p $process_id option, Need to unset twice + unset "opt_arr[${#opt_arr[@]}-1]" + unset "opt_arr[${#opt_arr[@]}-1]" + dlogi "Killing $cmd_args" kill -9 $process_id || true done diff --git a/test-case/check-suspend-resume.sh b/test-case/check-suspend-resume.sh index bca3093b..b76eed6d 100755 --- a/test-case/check-suspend-resume.sh +++ b/test-case/check-suspend-resume.sh @@ -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']='Process ID of aplay or arecord' +OPT_HAS_ARG['p']=1 OPT_VAL['p']='' + func_opt_parse_option "$@" func_lib_check_sudo @@ -170,7 +174,7 @@ sleep_once() { local i="$1" - dlogi "===== Round($i/$loop_count) =====" + dlogi "===== Loop($i/$loop_count) =====" # set up checkpoint for each iteration setup_kernel_check_point expected_wakeup_count=$((expected_wakeup_count+1)) @@ -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']}" || { + #func_lib_lsof_error_dump "$snd" + dloge "process status is abnormal, pid: ${OPT_VAL['p']}" + dlogi "dump ps for child process" + ps --ppid $$ -f + exit 1 + } + fi } main "$@"