core_assertions.rb: Tweak timeout limit

Increase the timeout limit when variance at rehearsal is small.
This commit is contained in:
Nobuyoshi Nakada 2023-04-03 14:10:16 +09:00 committed by Hiroshi SHIBATA
parent afbae64f05
commit d86deaf383

View file

@ -746,14 +746,14 @@ eom
end end
times.compact! times.compact!
tmin, tmax = times.minmax tmin, tmax = times.minmax
tmax *= tmax / tmin tbase = 10 ** Math.log10(tmax * ([(tmax / tmin), 2].max ** 2)).ceil
tmax = 10**Math.log10(tmax).ceil info = "(tmin: #{tmin}, tmax: #{tmax}, tbase: #{tbase})"
seq.each do |i| seq.each do |i|
next if i == first next if i == first
t = tmax * i.fdiv(first) t = tbase * i.fdiv(first)
*arg = pre.call(i) *arg = pre.call(i)
message = "[#{i}]: in #{t}s" message = "[#{i}]: in #{t}s #{info}"
Timeout.timeout(t, Timeout::Error, message) do Timeout.timeout(t, Timeout::Error, message) do
st = Process.clock_gettime(Process::CLOCK_MONOTONIC) st = Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield(*arg) yield(*arg)