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

case-lib/apause.exp: fix error message and comments #1222

Merged
merged 2 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions case-lib/apause.exp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# If you're new to expect:
#
# - Expect is "only" a Tcl extension and Tcl command.
# An "expect script" is a somewhat misleading shorthand for "a Tcl
# script that happens to use expect/"
# An "Expect script" is a somewhat misleading shorthand for "a Tcl
# script that happens to use Expect"
#
# - So, you can't understand this script (or any expect script) without
# some minimum Tcl knowledge. Especially: strings, quoting, lists and
Expand All @@ -14,7 +14,7 @@
# "Exploring Expect" is great: buy the book or check whether your
# employer has an online subscription. That book has a really nice and
# short (single chapter) Tcl introduction too.
# Tcl resources on the Internet are much better and expect resources.
# Tcl resources on the Internet are much better than Expect resources.
#
# - The man pages are not good for learning but they are a very useful
# references: run `apt install tcl8*-doc` or equivalent to get Tcl man
Expand Down Expand Up @@ -64,7 +64,7 @@ set rnd_range [lshift argv]
# "space" and aplay's acknowledgement + other various delays everywhere.
# Keep it that small for now for backwards compatibility.
if {$rnd_min < 20} {
puts "$argv0 ERROR: rnd_min=$rnd_min argument is lower than 100ms"
puts "$argv0 ERROR: rnd_min=$rnd_min argument is lower than 20ms"
exit 1
}

Expand Down Expand Up @@ -117,17 +117,17 @@ set state recording_requested
set in_max_burst false
set volume_always_zero true

# Key `expect` matching facts to keep in mind:
# Key Expect matching facts to keep in mind:
#
# 1. `expect` never cares about newlines on its own. You must use `\r`
# 1. Expect never cares about newlines on its own. You must use `\r`
# and/or `\n` _everywhere_ you care about newlines.
#
# 2. When to use \r versus \n versus \r\n (CRLF) in expect unfortunately
# 2. When to use \r versus \n versus \r\n (CRLF) in Expect unfortunately
# requires some tty _and_ arecord VU-meter knowledge and is a bit too
# complicated to be summarized here.
#
# 3. When nothing matches, expect keeps reading and keeps looking
# forward. As soon as something matches, `expect` _ignores_ what did
# 3. When nothing matches, Expect keeps reading and keeps looking
# forward. As soon as something matches, Expect _ignores_ what did
# not match earlier. Except when using ^ which is the "start of
# input" anchor (NOT a "start of line" anchor)
#
Expand All @@ -141,7 +141,7 @@ expect {

# Volume xx% or MAX line
#
# When not backpressured by a sleeping (=bad!) expect,
# When not backpressured by a sleeping (=bad!) Expect process,
# aplay seems to update its VU-meter about once every 100ms.
-re {#[^\r\n]*\| (..*%|MAX)\r} {

Expand All @@ -157,7 +157,10 @@ expect {

if [regexp {\| MAX} "$buffer_with_lf"] {
if { ! $in_max_burst } {
# TODO: upgrade this to a failure once all ALSA settings have been fixed.
# We unfortunately can't upgrade this to an ERROR
# because of "wontfix" bugs like
# https://github.com/thesofproject/sof-test/pull/931
# https://github.com/thesofproject/linux/issues/5048
log 0 "WARNING: volume MAX! Bug or bad ALSA settings?"
log 0 "$buffer_with_lf"
set in_max_burst true
Expand All @@ -167,7 +170,7 @@ expect {
}

if $volume_always_zero {
# This is not perfect because if `expect` becomes very slow
# This is not perfect because if Expect becomes very slow
# for some unknown reason, then there could be _multiple_
# volume lines in a single of these buffer iterations and then we
# could miss some non-zeros.
Expand Down Expand Up @@ -222,7 +225,10 @@ expect {

{=== PAUSE ===} {
if {$state != "pause_requested"} {
# TODO: upgrade this to an ERROR?
# TODO: upgrade this to an ERROR if we want to fix pause bugs like
# https://github.com/thesofproject/linux/issues/5109
# As of July 2024, pause is rather being disabled:
# https://github.com/thesofproject/linux/pull/5041
log 0 "WARNING: received == PAUSE == while in state $state! Ignoring."
exp_continue
}
Expand Down
4 changes: 4 additions & 0 deletions test-case/check-pause-release-suspend-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ rm -rf /tmp/sof-test.lock
# catch: Evaluate script and trap exceptional returns
# after ms: Ms must be an integer giving a time in milliseconds.
# The command sleeps for ms milliseconds and then returns.
# FIXME: this test was broken by 46dadd0 ("Add mutual exclusion and journalctl logging")
# because it never was compatible with is_subtest()
# FIXME: Need to handle more of aplay/arecord output. Need to apply similar fix with
# check-pause-resume.sh, multiple-pause-resume.sh
expect <<AUDIO
spawn $cmd -D $pcm -r $rate -c $channel -f $fmt -vv -i $dummy_file -q
set i 1
Expand Down
Loading