Skip to content
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

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

fredoh9
Copy link
Collaborator

@fredoh9 fredoh9 commented Jul 19, 2024

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.

@fredoh9 fredoh9 requested a review from a team as a code owner July 19, 2024 22:31
@fredoh9
Copy link
Collaborator Author

fredoh9 commented Jul 19, 2024

the main problem I'm trying to fix with this PR is...
For check-suspend-resume-with-audio.sh test, if loop count is 100, and the process is exit with input/output error, even with the error, testing keep going. hard to figure out the last minute of dmesg/mtrace for the error.

@@ -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]"
Copy link
Contributor

Choose a reason for hiding this comment

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

why twice?

Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. -p 2. PID

Copy link
Collaborator

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)

Copy link
Collaborator

@marc-hb marc-hb left a 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"
} 

Copy link
Collaborator

@marc-hb marc-hb left a 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.

test-case/check-suspend-resume-with-audio.sh Outdated Show resolved Hide resolved
@@ -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]"
Copy link
Collaborator

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 Show resolved Hide resolved
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"
Copy link
Collaborator

@marc-hb marc-hb Jul 20, 2024

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)

Copy link
Collaborator Author

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

Copy link
Collaborator

@marc-hb marc-hb Jul 24, 2024

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?

Copy link
Collaborator

@marc-hb marc-hb left a 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?

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"
Copy link
Collaborator

@marc-hb marc-hb Jul 24, 2024

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 <fred.oh@linux.intel.com>
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 <fred.oh@linux.intel.com>
@fredoh9 fredoh9 force-pushed the fix/suspend-resume-pid-check branch from 0d9ce9c to 2313bb0 Compare July 24, 2024 22:15
@fredoh9 fredoh9 requested review from marc-hb and ranj063 July 24, 2024 22:16
@fredoh9
Copy link
Collaborator Author

fredoh9 commented Jul 24, 2024

split into two commits, first commit has no functionality change.

@marc-hb
Copy link
Collaborator

marc-hb commented Jul 24, 2024

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 :-(

@fredoh9 fredoh9 merged commit 9bc74c8 into thesofproject:main Jul 25, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants