-
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
Catch aplay error messages in apause.exp and exit #1226
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,8 +111,8 @@ spawn {*}$argv | |
set start_time_ms [clock milliseconds]; # re-adjust | ||
set last_space_time 0 ; # could not resist that name | ||
|
||
# states: recording, pause_requested, paused, recording_requested | ||
set state recording_requested | ||
# states: active, pause_requested, paused, active_requested | ||
set state active_requested | ||
|
||
set in_max_burst false | ||
set volume_always_zero true | ||
|
@@ -137,8 +137,20 @@ set volume_always_zero true | |
|
||
expect { | ||
|
||
# `man re_syntax` claims that Tcl regular expressions are compliant | ||
# with the basic and extended POSIX ones while adding a 3rd, | ||
# extended flavor. It's not clear which flavor `expect -re` uses | ||
# but it's not the basic one. | ||
# Use {} not "" to avoid quoting issues and backslash proliferation. | ||
|
||
# When multiple patterns match, first pattern wins. | ||
|
||
-nocase -re {error.*\r|PAUSE.*no[[:blank:]]*hw[[:blank:]]*support.*\r} { | ||
set buffer_with_lf "[cr_to_lf $expect_out(buffer)]" | ||
log 0 "ERROR: $buffer_with_lf" | ||
exit 1 | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just to be clear on the commit message: PAUSE will be disabled unless we have a kernel parameter that keeps it enabled. All CI platforms SHALL keep the pause enabled. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's what I tried to say in the commit message but more briefly and without getting into Intel specifics. Too briefly? I mean, should I change the commit message or is your comment here enough? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thats' fine, just wanted to check we were aligned. |
||
# Volume xx% or MAX line | ||
# | ||
# When not backpressured by a sleeping (=bad!) Expect process, | ||
|
@@ -182,13 +194,13 @@ expect { | |
|
||
switch $state { | ||
|
||
recording { | ||
log 2 "Recording volume #... | xx%:\n[cr_to_lf $expect_out(buffer)]" | ||
active { | ||
log 2 "Volume #... | __%:\n[cr_to_lf $expect_out(buffer)]" | ||
exp_continue | ||
} | ||
|
||
pause_requested { | ||
log 2 "Volume #... | xx% left after requesting pause:\n[cr_to_lf $expect_out(buffer)]" | ||
log 2 "Volume #... | __% left after requesting pause:\n[cr_to_lf $expect_out(buffer)]" | ||
exp_continue | ||
} | ||
|
||
|
@@ -198,12 +210,12 @@ expect { | |
exit 1 | ||
} | ||
|
||
recording_requested { | ||
# First volume line printed since unpaused; recording successfully started! | ||
set state recording | ||
active_requested { | ||
# First volume line printed since unpaused; stream successfully started! | ||
set state active | ||
|
||
set _record_for [rand_min_range $rnd_min $rnd_range] | ||
log 1 "($pauses_counter/$repeat_count) Found volume ### | xx%, recording for $_record_for ms" | ||
log 1 "($pauses_counter/$repeat_count) Found volume ### | __%, active for $_record_for ms" | ||
|
||
set _delay [substract_time_since_last_space $_record_for] | ||
after $_delay "press_space; set state pause_requested" | ||
|
@@ -241,7 +253,7 @@ expect { | |
log 1 "($pauses_counter/$repeat_count) Found === PAUSE === , pausing for $_pausing_for ms" | ||
|
||
set _delay [substract_time_since_last_space $_pausing_for] | ||
after $_delay "press_space; set state recording_requested" | ||
after $_delay "press_space; set state active_requested" | ||
log 3 "last_space_time=$last_space_time; timer in $_delay" | ||
|
||
|
||
|
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.
laughing at my desk at 8am, no idea what this does haha.
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.
It took me only a couple days of practice to become productive in Tcl and expect (without any "stackoverflow garbage in, AI garbage out!"); it's not so bad.
{ }
is like the single quotes in shell except they can be nested.The basic syntax of the
expect
instruction is just:-nocase -re
means the pattern is a case-insensitive regular expression (as opposed to globbing).That regular expression has itself nothing specific to Tcl.
Thanks for taking a look!