summaryrefslogtreecommitdiff
path: root/test/-ext-/thread
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-08 10:41:53 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-08 10:55:44 +0900
commitf1c15f3e941192b2230035ce2aab29c3d6970fca (patch)
treee2f17b786e8b43f1247f47d9aa5a71e89663dc9f /test/-ext-/thread
parentcf991337fbfb197bee9c5b2d081e3a8615b39486 (diff)
downloadruby-f1c15f3e941192b2230035ce2aab29c3d6970fca.tar.gz
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.
Diffstat (limited to 'test/-ext-/thread')
-rw-r--r--test/-ext-/thread/test_instrumentation_api.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/-ext-/thread/test_instrumentation_api.rb b/test/-ext-/thread/test_instrumentation_api.rb
index 78e499c473..4830789546 100644
--- a/test/-ext-/thread/test_instrumentation_api.rb
+++ b/test/-ext-/thread/test_instrumentation_api.rb
@@ -33,7 +33,9 @@ class TestThreadInstrumentation < Test::Unit::TestCase
thr = Thread.new { fib(30) }
Bug::ThreadInstrumentation.reset_counters
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
def test_thread_instrumentation_fork_safe