mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Relax assertion condition for thread local counters
Recently `TestThreadInstrumentation#test_join_counters` often fails as ``` <[1, 1, 1]> expected but was <[2, 2, 2]>. ``` Probably it seems that the thread is suspended more than once. There may be no guarantee that the subject thread never be suspended more than once.
This commit is contained in:
parent
cf991337fb
commit
f1c15f3e94
1 changed files with 3 additions and 1 deletions
|
@ -33,7 +33,9 @@ class TestThreadInstrumentation < Test::Unit::TestCase
|
||||||
thr = Thread.new { fib(30) }
|
thr = Thread.new { fib(30) }
|
||||||
Bug::ThreadInstrumentation.reset_counters
|
Bug::ThreadInstrumentation.reset_counters
|
||||||
thr.join
|
thr.join
|
||||||
assert_equal [1, 1, 1], Bug::ThreadInstrumentation.local_counters
|
Bug::ThreadInstrumentation.local_counters.each_with_index do |counter, index|
|
||||||
|
assert_operator counter, :>, 0, "counter[#{index}]"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_thread_instrumentation_fork_safe
|
def test_thread_instrumentation_fork_safe
|
||||||
|
|
Loading…
Reference in a new issue