-
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-resume: handle volume MAX output in expect #931
Conversation
multiple-pause-resume.sh need to be handled in same way. I will update the same shortly |
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.
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
d84272f
Compare
@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
|
test-case/multiple-pause-resume.sh
Outdated
@@ -135,6 +135,13 @@ expect { | |||
if { \$i > $repeat_count } { exit 0 } | |||
exp_continue | |||
} | |||
"*#*+*MAX" { | |||
set sleep_t [expr int([expr rand() * $rnd_range]) + $rnd_min ] |
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 our tests generally have a lot of randomness? Doesn't that make failures less deterministic?
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.
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
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. static void print_vu_meter_mono(int perc, int maxperc)
{
const int bar_length = 50;
char line[80];
int val;
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");
else
sprintf(line + val, "| %02i%%", maxperc);
fputs(line, stderr);
if (perc > 100)
fprintf(stderr, _(" !clip "));
} This is "PAUSE" output static void check_stdin(void)
{
unsigned char b;
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);
}
}
}
} |
check-pause-release-suspend-resume.sh is not being used by SOF CI yet. I can add FIXME note for it |
d84272f
to
244c198
Compare
I tested locally and pushed my changes, I should whether check device test is going smooth. thank you for your review. |
Please submit the error handling commit in a different PR so we can fast track it. |
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. |
@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. |
What is the relationship between pressing the space bar and volume control @fredoh9 ? |
244c198
to
ab6d555
Compare
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
b8cb4bb
Compare
@plbossart OK? |
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) |
@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.
SOFCI TEST |
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. |
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. |
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. |
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 tested this script with expect -d
and it works "by accident" either before or after the PR.
cc:
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
|
Comments rescued from superseded thesofproject#931. Signed-off-by: Fred Oh <[email protected]>
@@ -96,18 +96,21 @@ do | |||
dlogi "Entering expect script with: | |||
$cmd $SOF_ALSA_OPTS $cmd_opts -D $dev -r $rate -c $channel -f $fmt -vv -i $file_name -q" | |||
|
|||
# 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 |
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.
Marc added better solution. |
Comments rescued from superseded #931. Signed-off-by: Fred Oh <[email protected]>
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 [email protected]
related: