-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check-suspend-resume: check process id in each loop for audio test case #1223
check-suspend-resume: check process id in each loop for audio test case #1223
Conversation
the main problem I'm trying to fix with this PR is... |
@@ -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]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- -p 2. PID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this if you simply use a copy, see suspend_opts
above.
Every time you change a variable in place, consider making a copy instead. It's always better for correctness and concurrency (it's the default in functional languages)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: just read your comment above.
This seems a bit complicated... why not just check the process status when the subtest returns a failure? I mean here:
"${TESTDIR}"/check-suspend-resume.sh "${opt_arr[@]}" || {
# new code to check process status
die "suspend resume failed"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea is good, small changes requested.
@@ -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]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this if you simply use a copy, see suspend_opts
above.
Every time you change a variable in place, consider making a copy instead. It's always better for correctness and concurrency (it's the default in functional languages)
test-case/check-suspend-resume.sh
Outdated
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why commented out? This is a failure and it's very likely very hard to reproduce. We want as much information as possible. This will be called only once (and usually: zero)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$snd is only available in check-suspend-resume-with-audio.sh
I put a FIXME comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if this can never work then why have this commented out line present at all?
9e7a07e
to
0d9ce9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change looks good but why:
- all these large, git-breaking whitespace changes?
- commented out code that can never work?
test-case/check-suspend-resume.sh
Outdated
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if this can never work then why have this commented out line present at all?
No functionality change. indentation chagne for option variables. One double quote reduce shellcheck error. Loop/round terms are used for iteration in test cases, this is loop. Signed-off-by: Fred Oh <[email protected]>
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]>
0d9ce9c
to
2313bb0
Compare
split into two commits, first commit has no functionality change. |
A good few shellcheck warnings in https://github.com/thesofproject/sof-test/actions/runs/10084785339/job/27884307459?pr=1223 Most seem old and all seem harmless but it's a pity to include a cleanup commit in this PR and still have that many warnings :-( |
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.