diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2022-07-13 13:13:33 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2022-07-13 14:13:41 +0200 |
commit | 268269687c8747eb0bb67b09025b7ff7f495eba6 (patch) | |
tree | 5630a8abc2a1041681e2a8c3f771f63b2c9c5e81 /test | |
parent | c4e2973733c03525ca42f0aecca6f2d834b88a70 (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6128
Diffstat (limited to 'test')
-rw-r--r-- | test/-ext-/thread/test_instrumentation_api.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 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 |