Skip to content

Commit a5e2ae6

Browse files
committed
multiple-pause-resume.sh: switch to new apause.exp script
See long commit message in previous commit adding apause.exp Signed-off-by: Marc Herbert <[email protected]>
1 parent 006946c commit a5e2ae6

1 file changed

Lines changed: 9 additions & 24 deletions

File tree

test-case/multiple-pause-resume.sh

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -121,30 +121,12 @@ func_pause_resume_pipeline()
121121
# expr rand(): produces random numbers between 0 and 1
122122
# after ms: Ms must be an integer giving a time in milliseconds.
123123
# The command sleeps for ms milliseconds and then returns.
124-
dlogi "$pcm to command: $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file -q"
125-
expect <<END &
126-
spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file -q
127-
set i 1
128-
expect {
129-
"*#*+*\%" {
130-
set sleep_t [expr int([expr rand() * $rnd_range]) + $rnd_min ]
131-
puts "\r(\$i/$repeat_count) pcm'$pcm' cmd'$cmd' id'$idx': Wait for \$sleep_t ms before pause"
132-
send " "
133-
after \$sleep_t
134-
exp_continue
135-
}
136-
"*PAUSE*" {
137-
set sleep_t [expr int([expr rand() * $rnd_range]) + $rnd_min ]
138-
puts "\r(\$i/$repeat_count) pcm'$pcm' cmd'$cmd' id'$idx': Wait for \$sleep_t ms before resume"
139-
send " "
140-
after \$sleep_t
141-
incr i
142-
if { \$i > $repeat_count } { exit 0 }
143-
exp_continue
144-
}
145-
}
146-
exit 1
147-
END
124+
125+
local shortname="cmd$idx $cmd $pcm"
126+
127+
dlogi "Starting: apause.exp $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file &"
128+
"$TOPDIR"/case-lib/apause.exp "$shortname" "$repeat_count" "$rnd_min" "$rnd_range" \
129+
"$cmd" -D "$dev" -r "$rate" -c "$channel" -f "$fmt" -vv -i "$file" &
148130
}
149131

150132
# to prevent infinite loop, 5 second per a repeat is plenty
@@ -163,6 +145,9 @@ do
163145
do
164146
func_pause_resume_pipeline "$idx"
165147
pid_lst=("${pid_lst[@]}" $!)
148+
# Stagger a bit to avoid preambles interleaved with each other.
149+
# It's very far from perfect but it helps a little bit.
150+
sleep 0.1
166151
done
167152
# wait for expect script finished
168153
dlogi "wait for expect process finished"

0 commit comments

Comments
 (0)