-
Notifications
You must be signed in to change notification settings - Fork 46
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-pause-release-suspend-resume: timing fixes + switch to sof-tplgreader #885
Conversation
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.
can this be added to run-all-tests.sh?
We need all developpers to replicate what CI does.
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.
Since you're rewriting most of the test, please take the opportunity to move all the code to functions, see why in #740. At least one main()
function, maybe others too.
Done. |
PR is updated. |
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.
The breakdown into multiple commits was a nice try but it didn't really work:
- The first commit message talks about sof-tplgreader only but it has tons of other, unrelated changes.
- The move to functions should have come first (but now it's too late).
You can still try to keep the "small" commits as independent commits if possible but please squash the 2 big commits into a single big commit, it's just simpler and more "honest".
Keep the run-all-tests.sh
commit separate of course.
file_name=${OPT_VAL['F']} | ||
parse_param() | ||
{ | ||
func_opt_parse_option $@ |
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.
shellcheck, easy
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.
Fixed.
OPT_NAME['p']='pcm' OPT_DESC['p']='audio pcm. Example: hw:0,0' | ||
OPT_HAS_ARG['p']=1 OPT_VAL['p']='hw:0,0' | ||
OPT_NAME['m']='mode' OPT_DESC['m']='test mode. Example: playback; capture' | ||
OPT_HAS_ARG['m']=1 OPT_VAL['m']='playback' |
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.
Please remove all these whitespace changes in this area. They make it impossible to find the real changes.
https://wiki.openstack.org/wiki/GitCommitMessages#Things_to_avoid_when_creating_commits
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.
Answering myself: reviewing commits individually avoids this problem.
|
||
run_test() | ||
{ | ||
for idx in $(seq 0 $((PIPELINE_COUNT - 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 can save one indentation level by moving the for
loop to the main()
function.
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.
Good suggestion. PR is updated.
ret=$? | ||
if [ $ret -ne 0 ]; then | ||
sof-process-kill.sh || dlogw "sof-process-kill.sh failed" | ||
exit $ret |
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.
Do we really want to preserve the exit code here? If it's 2 then it will be misinterpreted as a SKIP! We experienced this recently in some different place.
sleep_opts="-l 1 -T ${OPT_VAL['T']}" | ||
else | ||
sleep_opts="-l 1" | ||
fi |
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.
sleep_opts="-l 1"
[ -z "${OPT_VAL['T']}" ] || sleep_opts+="-T ${OPT_VAL['T']}"
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.
Shell script code looks good to me except for a couple shellcheck warnings easy to fix.
@plbossart or @ranj063 can you please review the test / expect logic? I think one of you requested this?
do | ||
run_test | ||
if [ $? -ne 0 ]; then | ||
sof-process-kill.sh || dlogw "Kill process catch error" |
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.
sof-process-kill.sh || dlogw "Kill process catch error" | |
sof-process-kill.sh || dlogw "sof-process-kill.sh cleanup failed" |
OPT_NAME['p']='pcm' OPT_DESC['p']='audio pcm. Example: hw:0,0' | ||
OPT_HAS_ARG['p']=1 OPT_VAL['p']='hw:0,0' | ||
OPT_NAME['m']='mode' OPT_DESC['m']='test mode. Example: playback; capture' | ||
OPT_HAS_ARG['m']=1 OPT_VAL['m']='playback' |
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.
Answering myself: reviewing commits individually avoids this problem.
for idx in $(seq 0 $((PIPELINE_COUNT - 1))) | ||
do | ||
run_test | ||
if [ $? -ne 0 ]; then |
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.
As reported by shellcheck:
if [ $? -ne 0 ]; then | |
run_test || { |
One possible reason to use ret=$?
is when you want to exit $ret
after cleanup but you're not doing that here.
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.
Updated.
@@ -51,47 +51,50 @@ set -e | |||
## * No unexpected errors should be present in dmesg during or after test | |||
## completion. | |||
|
|||
# shellcheck source=case-lib/lib.sh | |||
source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh |
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.
Last shellcheck warning / quoting issue.
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.
Fixed.
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.
Fixed.
No, not completely. Can you please run shellcheck locally before pushing? Especially after fixing shellcheck issues? It would have saved a lot of time.
sudo apt install shellcheck
shellcheck -x test-case/check-pause-release-suspend-resume.sh
I don't see any changes to run-all-tests.sh @keqiaozhang ? |
That was moved to #886, not sure why. No big deal. |
@plbossart @marc-hb @ranj063 |
There's one shellcheck warning very easy to fix. We should not still be looking at trivial shellcheck warnings 1 month after the first version, this is a waste of time. Run shellcheck locally before submitting, it takes a split second. |
warning and code cleanup fix one shellcheck warning and some code cleanup. Signed-off-by: Keqiao Zhang <[email protected]>
parse pipelines instead of specifying PCM to test Consistent with other test scripts to use sof-tplgreader to parse audio pipelines designed in tplg and use -m option to select part of them to test. Signed-off-by: Keqiao Zhang <[email protected]>
checking the aplay/arecord status after pause/release This interval is too short which may casue timing issue on some platforms. Extend the interval to 500ms to avoid such issues. Signed-off-by: Keqiao Zhang <[email protected]>
the sleep type for suspend/resuse There are 2 sleep types designed in /sys/power/mem_sleep add a -T option to specify which one you want to test. Signed-off-by: Keqiao Zhang <[email protected]>
pausing the audio stream There's a latency when starting audio stream, if pause the audio stream directly after it starts, it may lead to some unexpected errors. Add a delay to ensure that audio stream is in a normal state before pusing. Signed-off-by: Keqiao Zhang <[email protected]>
Move the code to a function to make the code easy to understand and maintain. Signed-off-by: Keqiao Zhang <[email protected]>
Add 2 new cases to run all test: 1. pause-release-suspend-resume-with-playback 2. pause-release-suspend-resume-with-capture Signed-off-by: Keqiao Zhang <[email protected]>
@plbossart , @ranj063 , @lyakh could you please review the pause/release/suspend/resume logic? |
I don't speak shell fluently and I am unable to figure out what the 'logic' is in this heap of shell commands. I will note however that I don't understand why the pause can only be done after a delay. What possible 'unexpected errors' could happen if we pause immediately after starting? It looks like we are masking a set of possible issues without a clear justification. |
Note the vast majority of this test and PR is not written in shell script but in https://en.wikipedia.org/wiki/Expect |
This test was finally rewritten in 006946c + follow-ups. |
No description provided.