Repository navigation
check-pause-release-suspend-resume: timing fixes + switch to sof-tplgreader - #885
keqiaozhang wants to merge 7 commits into
Conversation
plbossart
left a comment
There was a problem hiding this comment.
can this be added to run-all-tests.sh?
We need all developpers to replicate what CI does.
Done. |
PR is updated. |
marc-hb
left a comment
There was a problem hiding this comment.
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 $@ |
| 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.
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.
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.
You can save one indentation level by moving the for loop to the main() function.
There was a problem hiding this comment.
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.
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.
sleep_opts="-l 1"
[ -z "${OPT_VAL['T']}" ] || sleep_opts+="-T ${OPT_VAL['T']}"
marc-hb
left a comment
There was a problem hiding this comment.
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.
| 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.
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.
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.
| ## completion. | ||
|
|
||
| # shellcheck source=case-lib/lib.sh | ||
| source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh |
There was a problem hiding this comment.
Last shellcheck warning / quoting issue.
There was a problem hiding this comment.
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 <keqiao.zhang@intel.com>
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 <keqiao.zhang@intel.com>
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 <keqiao.zhang@intel.com>
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 <keqiao.zhang@intel.com>
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 <keqiao.zhang@intel.com>
Move the code to a function to make the code easy to understand and maintain. Signed-off-by: Keqiao Zhang <keqiao.zhang@intel.com>
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 <keqiao.zhang@intel.com>
|
@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.