mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
c4e2973733
commit
268269687c
Notes:
git
2022-07-13 21:14:01 +09:00
1 changed files with 9 additions and 0 deletions
|
@ -6,6 +6,15 @@ class TestThreadInstrumentation < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue