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

ruby-changes:29324

From: naruse <ko1@a...>
Date: Tue, 18 Jun 2013 13:43:55 +0900 (JST)
Subject: [ruby-changes:29324] naruse:r41376 (trunk): Add timeout to avoid stick

naruse	2013-06-18 13:43:21 +0900 (Tue, 18 Jun 2013)

  New Revision: 41376

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41376

  Log:
    Add timeout to avoid stick
    
    http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20130618T030202Z.diff.html.gz

  Modified files:
    trunk/test/ruby/test_notimp.rb

Index: test/ruby/test_notimp.rb
===================================================================
--- test/ruby/test_notimp.rb	(revision 41375)
+++ test/ruby/test_notimp.rb	(revision 41376)
@@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_notimp.rb#L1
 require 'test/unit'
+require 'timeout'
 require 'tmpdir'
 
 class TestNotImplement < Test::Unit::TestCase
@@ -20,13 +21,15 @@ class TestNotImplement < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_notimp.rb#L21
   end
 
   def test_call_fork
-    if Process.respond_to?(:fork)
-      assert_nothing_raised {
-        pid = fork {}
-        Process.wait pid
-      }
-    end
-  end
+    pid = nil
+    Timeout.timeout(1) {
+      pid = fork {sleep}
+      Process.wait pid
+      pid = nil
+    }
+  ensure
+    Process.kill :KILL, pid if pid
+  end if Process.respond_to?(:fork)
 
   def test_call_lchmod
     if File.respond_to?(:lchmod)

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

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