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

ruby-changes:72531

From: Jean <ko1@a...>
Date: Wed, 13 Jul 2022 21:13:54 +0900 (JST)
Subject: [ruby-changes:72531] 268269687c (master): thread/test_instrumentation_api: cleanup all existing threads in setup

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

From 268269687c8747eb0bb67b09025b7ff7f495eba6 Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@g...>
Date: Wed, 13 Jul 2022 13:13:33 +0200
Subject: thread/test_instrumentation_api: cleanup all existing threads in
 setup

We saw the following failure:
```
TestThreadInstrumentation#test_thread_instrumentation [/tmp/ruby/v3/src/trunk-random3/test/-ext-/thread/test_instrumentation_api.rb:25]:
Expected 0..3 to include 4.
```

Which shouldn't happen unless somehow there was a leaked thread.
---
 test/-ext-/thread/test_instrumentation_api.rb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/-ext-/thread/test_instrumentation_api.rb b/test/-ext-/thread/test_instrumentation_api.rb
index b8f21fa92a..a187a3c13f 100644
--- a/test/-ext-/thread/test_instrumentation_api.rb
+++ b/test/-ext-/thread/test_instrumentation_api.rb
@@ -6,6 +6,15 @@ class TestThreadInstrumentation < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/-ext-/thread/test_instrumentation_api.rb#L6
     pend("No windows support") if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
 
     require '-test-/thread/instrumentation'
+
+    Thread.list.each do |thread|
+      if thread != Thread.current
+        thread.kill
+        thread.join rescue nil
+      end
+    end
+    assert_equal [Thread.current], Thread.list
+
     Bug::ThreadInstrumentation.reset_counters
     Bug::ThreadInstrumentation::register_callback
   end
-- 
cgit v1.2.1


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

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