[前][次][番号順一覧][スレッド一覧]

ruby-changes:72464

From: Nobuyoshi <ko1@a...>
Date: Fri, 8 Jul 2022 11:15:47 +0900 (JST)
Subject: [ruby-changes:72464] f1c15f3e94 (master): Relax assertion condition for thread local counters

https://git.ruby-lang.org/ruby.git/commit/?id=f1c15f3e94

From f1c15f3e941192b2230035ce2aab29c3d6970fca Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 8 Jul 2022 10:41:53 +0900
Subject: 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.
---
 test/-ext-/thread/test_instrumentation_api.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 https://github.com/ruby/ruby/blob/trunk/test/-ext-/thread/test_instrumentation_api.rb#L33
     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
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]