Uh oh!
There was an error while loading. Please reload this page.
check-pause-resume: handle volume MAX output in expect - #931
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
fredoh9
commented
Jul 13, 2022
multiple-pause-resume.sh need to be handled in same way. I will update the same shortly |
There was a problem hiding this comment.
MAX case is same as playing case.
It it is the same then please don't copy/paste the code, it must be possible to match both and share the code.
Also, please add a fallback case that prints an error so no one wastes hours next time aplay prints something unexpected.
But more importantly: this test never failed like this. Why is MAX suddenly OK? This looks like a firmware bug?!
EDIT: because alsa settings were accidentally changed: thesofproject/linux#3766
multiple-pause-resume.sh need to be handled in same way. I will update the same shortly
Maybe it's time to move some new .expect file shared between tests?
e2e2620 to
d84272fComparefredoh9
commented
Jul 13, 2022
@marc-hb I will check how we can share the same code in expect. Need to search expect manual |
@marc-hb still looking for sharing the case in expect script. And also I'm trying to handle 'else' case but expect script didn't work like that, i thought it will match top to bottom but "*" case hit all the time. diff --git a/test-case/check-pause-resume.sh b/test-case/check-pause-resume.sh
index 170aff7..cdcd203 100755
--- a/test-case/check-pause-resume.sh
+++ b/test-case/check-pause-resume.sh
@@ -116,6 +116,18 @@ expect {
if { \$i >$repeat_count } { exit 0 }
exp_continue
}
+ "*#*+*MAX" {
+ set sleep_t [expr int([expr rand() *$rnd_range]) + $rnd_min ]
+ puts "\r(\$i/$repeat_count) Wait for \$sleep_t ms before pause"
+ send ""
+ after \$sleep_t
+ exp_continue
+ }
+ "*" {
+ puts "\r Invalid output detected, Wait for 500ms and recheck"
+ set sleep_t 500
+ after \$sleep_t
+ exp_continue
+ }
}
exit 1
END
|
| exp_continue | ||
| } | ||
| "*#*+*MAX" { | ||
| set sleep_t [expr int([expr rand() * $rnd_range]) + $rnd_min ] |
There was a problem hiding this comment.
Do our tests generally have a lot of randomness? Doesn't that make failures less deterministic?
There was a problem hiding this comment.
In general we don't like randomness in testing. In this pause/resume, we intentionally introduce randomness on ranger of interval to discover easily fw bug
fredoh9
commented
Jul 13, 2022
I missed |
Strange. From https://www.tcl.tk/man/expect5.31/expect.1.html
EDIT: this is probably because of a lack of |
This is the source code for VU meter output. Last line output will be "!clip"? I think this is only error we can handle extra. staticvoidprint_vu_meter_mono(intperc, intmaxperc)
{
constintbar_length=50;
charline[80];
intval;
for (val=0; val <= perc*bar_length / 100&&val<bar_length; val++)
line[val] ='#';
for (; val <= maxperc*bar_length / 100&&val<bar_length; val++)
line[val] =' ';
line[val] ='+';
for (++val; val <= bar_length; val++)
line[val] =' ';
if (maxperc>99)
sprintf(line+val, "| MAX");
elsesprintf(line+val, "| %02i%%", maxperc);
fputs(line, stderr);
if (perc>100)
fprintf(stderr, _(" !clip "));
}This is "PAUSE" output staticvoidcheck_stdin(void)
{
unsigned charb;
if (!interactive)
return;
if (fd!=fileno(stdin)) {
while (read(fileno(stdin), &b, 1) ==1) {
if (b==' '||b=='\r') {
while (read(fileno(stdin), &b, 1) ==1);
fprintf(stderr, _("\r=== PAUSE === "));
fflush(stderr);
do_pause();
fprintf(stderr, " \r");
fflush(stderr);
}
}
}
} |
fredoh9
commented
Jul 13, 2022
check-pause-release-suspend-resume.sh is not being used by SOF CI yet. I can add FIXME note for it |
d84272f to
244c198Comparefredoh9
commented
Jul 14, 2022
I tested locally and pushed my changes, I should whether check device test is going smooth. thank you for your review. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
marc-hb
commented
Jul 14, 2022
Please submit the error handling commit in a different PR so we can fast track it. |
fredoh9
commented
Jul 14, 2022
From device test, multiple-pause-resume.sh failed in multiple platforms. It is due to I'm able to reproduce same error with TGLU_SKU0A32_SDCA also. It looks some more messages are left to be handled. |
plbossart
commented
Jul 14, 2022
@fredoh9 I am struggling to figure out what volume has to do with pause_push/pause_release. I went through the entire thread and I have zero understanding of the issue. |
@plbossart First problem is expect script which trigger spacebar event to aplay/arecord in interactive mode. "MAX" volume was not handled properly. Momentary MAX can be ignored but hw:0.4 is 100% DC only, this case fails 100%. 2nd problem, why is hw:0,4 input becoming DC, @marc-hb track the daily test, he think kernel regression. |
plbossart
commented
Jul 14, 2022
What is the relationship between pressing the space bar and volume control @fredoh9 ? |
244c198 to
ab6d555Comparefredoh9
commented
Jul 14, 2022
Right, nothing to do with. But expect script to look for aplay/arecord output to decide what to do. When first wrote the test script, we didn't expect MAX volume is one of possibility. That's why I said first problem is on expect script. |
ab6d555 to
b8cb4bbCompare
We confirmed with Realtek that the audio settings are incorrect, so I am not sure why any changes are needed in sof-test. I would fix the audio settings first instead of making the tool work-around the bad settings. Edit: link to thread with Realtek thesofproject/linux#3766 (comment) |
marc-hb
commented
Jul 25, 2022
@fredoh9 can you confirm the test WILL STILL FAIL with this PR in the same system configuration as before? |
I don't understand what this PR fixes, nor that the patch does.
marc-hb
commented
Jun 18, 2024
SOFCI TEST |
marc-hb
commented
Jun 18, 2024
https://sof-ci.01.org/softestpr/PR931/build519/devicetest/index.html?model=MTLP_RVP_HDA&testcase=multiple-pause-resume-50 shows some "MAX" traces but now looking different. Saving the link for future investigation. |
fredoh9
commented
Jun 18, 2024
The real problem is that the DMIC volume suddenly becomes 100% for no reason. I suspect something to do with electrical problem with DMIC transducer board, but don't know the root cause. Test failure rate varies between device/DMIC board. The whole point of this PR is to match the expected output regardless of the DMIC output or volume level. @marc-hb I'm looking at this PR now. Even with this PR, it silll fails when DMIC MAX volume happens. Looks the matching is broken. I will update the fix shortly. |
fredoh9
commented
Jun 18, 2024
I scrolled up to read all the discussion, we concluded the volume MAX is failure case, not much thing to do with this PR. |
This PR is all about handling that failure better. |
This all started as an effort to solve test failures caused by "MAX" volume. See #931 and others linked from there for more context. Another obvious issue was the duplication of `expect` code across two tests (check-pause-resume.sh and multiple-pause-resume.sh) After a bit of time actually "testing the tests" I realized the original author did not really understand `expect` or the problem. So I rewrote the entire `expect` part. The list of previous issues is a bit too long not to forget any but here are some: - The script could get "out of sync" with aplay and report that it was paused when it was actually resumed! And vice-versa. - De-duplication; obviously. - Moving to a separate script also solves the following problems: - Can be invoked, tested and debugged separately outside any shell script - Simplifies quoting - Unlocks editor features like syntax checking - Proper understanding and handling of newlines. - The expect script does not "sleep" anymore, which stops backpressuring and blocking the console output from aplay - with unknown side effects! - Adding `log_user 0` makes the test logs readable at last - Add decent logging for easier maintenance - Logging timestamps demonstrate that the entire aproach is too slow for pause/resume cycles shorter than ~200 ms. Default values won't be changed yet but at least the problem is now obvious. - Handle "MAX" volume! Not an error yet because it happens really across the board (MAX does usualy not happen long enough to timeout and _fail_ across the board) but the code is ready to upgrade the "MAX" warning to an ERROR with a one-line change. - Report EOF and timeouts differently. - Probably others. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This all started as an effort to solve test failures caused by "MAX" volume. See thesofproject#931 and others linked from there for more context. Another obvious issue was the duplication of `expect` code across two tests (check-pause-resume.sh and multiple-pause-resume.sh) After a bit of time actually "testing the tests" I realized the original author did not really understand `expect` or the problem. So I rewrote the entire `expect` part. The list of previous issues is a bit too long not to forget any but here are some: - The script could get "out of sync" with aplay and report that it was paused when it was actually resumed! And vice-versa. - De-duplication; obviously. - Moving to a separate script also solves the following problems: - Can be invoked, tested and debugged separately outside any shell script - Simplifies quoting - Unlocks editor features like syntax checking - Proper understanding and handling of newlines. - The expect script does not "sleep" anymore, which stops backpressuring and blocking the console output from aplay - with unknown side effects! - Adding `log_user 0` makes the test logs readable at last - Add decent logging for easier maintenance - Logging timestamps demonstrate that the entire aproach is too slow for pause/resume cycles shorter than ~200 ms. Default values won't be changed yet but at least the problem is now obvious. - Handle "MAX" volume! Not an error yet because it happens really across the board (MAX does usualy not happen long enough to timeout and _fail_ across the board) but the code is ready to upgrade the "MAX" warning to an ERROR with a one-line change. - Report EOF and timeouts differently. - Probably others. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
marc-hb
commented
Jul 10, 2024
I realized the existing (and duplicated) expect script was hopelessly broken so I rewrote it and submitted it in: |
This all started as an effort to solve test failures caused by "MAX" volume. See thesofproject#931 and others linked from there for more context. Another obvious issue was the duplication of `expect` code across two tests (check-pause-resume.sh and multiple-pause-resume.sh) After a bit of time actually "testing the tests" I realized the original author did not really understand `expect` or the problem. So I rewrote the entire `expect` part. The list of previous issues is a bit too long not to forget any but here are some: - The script could get "out of sync" with aplay and report that it was paused when it was actually resumed! And vice-versa. - De-duplication; obviously. - Moving to a separate script also solves the following problems: - Can be invoked, tested and debugged separately outside any shell script - Simplifies quoting - Unlocks editor features like syntax checking - Proper understanding and handling of newlines. - The expect script does not "sleep" anymore, which stops backpressuring and blocking the console output from aplay - with unknown side effects! - Adding `log_user 0` makes the test logs readable at last - Add decent logging for easier maintenance - Logging timestamps demonstrate that the entire aproach is too slow for pause/resume cycles shorter than ~200 ms. Default values won't be changed yet but at least the problem is now obvious. - Handle "MAX" volume! Not an error yet because it happens really across the board (MAX does usualy not happen long enough to timeout and _fail_ across the board) but the code is ready to upgrade the "MAX" warning to an ERROR with a one-line change. - Report EOF and timeouts differently. - Probably others. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This all started as an effort to solve test failures caused by "MAX" volume. See thesofproject#931 and others linked from there for more context. Another obvious issue was the duplication of `expect` code across two tests (check-pause-resume.sh and multiple-pause-resume.sh) After a bit of time actually "testing the tests" I realized the original author did not really understand `expect` or the problem. So I rewrote the entire `expect` part. The list of previous issues is a bit too long not to forget any but here are some: - The script could get "out of sync" with aplay and report that it was paused when it was actually resumed! And vice-versa. - De-duplication; obviously. - Moving to a separate script also solves the following problems: - Can be invoked, tested and debugged separately outside any shell script - Simplifies quoting - Unlocks editor features like syntax checking - Proper understanding and handling of newlines. - The expect script does not "sleep" anymore, which stops backpressuring and blocking the console output from aplay - with unknown side effects! - Adding `log_user 0` makes the test logs readable at last - Add decent logging for easier maintenance - Logging timestamps demonstrate that the entire aproach is too slow for pause/resume cycles shorter than ~200 ms. Default values won't be changed yet but at least the problem is now obvious. - Handle "MAX" volume! Not an error yet because it happens really across the board (MAX does usualy not happen long enough to timeout and _fail_ across the board) but the code is ready to upgrade the "MAX" warning to an ERROR with a one-line change. - Report EOF and timeouts differently. - Probably others. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This all started as an effort to solve test failures caused by "MAX" volume. See #931 and others linked from there for more context. Another obvious issue was the duplication of `expect` code across two tests (check-pause-resume.sh and multiple-pause-resume.sh) After a bit of time actually "testing the tests" I realized the original author did not really understand `expect` or the problem. So I rewrote the entire `expect` part. The list of previous issues is a bit too long not to forget any but here are some: - The script could get "out of sync" with aplay and report that it was paused when it was actually resumed! And vice-versa. - De-duplication; obviously. - Moving to a separate script also solves the following problems: - Can be invoked, tested and debugged separately outside any shell script - Simplifies quoting - Unlocks editor features like syntax checking - Proper understanding and handling of newlines. - The expect script does not "sleep" anymore, which stops backpressuring and blocking the console output from aplay - with unknown side effects! - Adding `log_user 0` makes the test logs readable at last - Add decent logging for easier maintenance - Logging timestamps demonstrate that the entire aproach is too slow for pause/resume cycles shorter than ~200 ms. Default values won't be changed yet but at least the problem is now obvious. - Handle "MAX" volume! Not an error yet because it happens really across the board (MAX does usualy not happen long enough to timeout and _fail_ across the board) but the code is ready to upgrade the "MAX" warning to an ERROR with a one-line change. - Report EOF and timeouts differently. - Probably others. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
marc-hb
commented
Jul 15, 2024
|
Comments rescued from superseded thesofproject#931. Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
| # NOTE: Purposely we don't handle 'Volume MAX' case. So that the MAX output can fall into | ||
| # 'anything else' case and error out. | ||
| # FIXME: share this expect script as a common function |
Marc added better solution (#1222) |
Comments rescued from superseded #931. Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
When volume is MAX, current expect misses the case. Why volume is MAX is
separate question. Momentary pop can be ingored but if volume is 100% DC
return error.
And added for ignoring dump-hw-params and last case is anything else,
it means unexpected outputs, will return error also.
This is example of output from aplay or arecord.
"## + | 11%"
"=== PAUSE ==="
"##################################################+| MAX"
Signed-off-by: Fred Oh fred.oh@linux.intel.com
related: