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

ruby-changes:56192

From: Nobuyoshi <ko1@a...>
Date: Sat, 22 Jun 2019 18:47:27 +0900 (JST)
Subject: [ruby-changes:56192] Nobuyoshi Nakada: bad66f3e36 (trunk): Show timed out threads

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

From bad66f3e369810e1cca90493830d5e06485c3c30 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 22 Jun 2019 18:39:06 +0900
Subject: Show timed out threads

* test/lib/test/unit/assertions.rb (assert_join_threads): kill and
  show timed out threads.

diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb
index c3a2a5b..da2fc59 100644
--- a/test/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -852,8 +852,15 @@ eom https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L852
             values << th.value
           rescue Exception
             errs << [th, $!]
+            th = nil
           end
         end
+        values
+      ensure
+        if th&.alive?
+          th.raise(Timeout::Error.new)
+          th.join rescue errs << [th, $!]
+        end
         if !errs.empty?
           msg = "exceptions on #{errs.length} threads:\n" +
             errs.map {|t, err|
@@ -865,7 +872,6 @@ eom https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L872
           end
           raise MiniTest::Assertion, msg
         end
-        values
       end
 
       class << (AssertFile = Struct.new(:failure_message).new)
-- 
cgit v0.10.2


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

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