From e4ef5b282be199cd6e20600610db44fd3920ad40 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 18 Jun 2013 04:43:21 +0000 Subject: Add timeout to avoid stick http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20130618T030202Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_notimp.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'test/ruby/test_notimp.rb') diff --git a/test/ruby/test_notimp.rb b/test/ruby/test_notimp.rb index c29119eac9..0ce0fc48a7 100644 --- a/test/ruby/test_notimp.rb +++ b/test/ruby/test_notimp.rb @@ -1,4 +1,5 @@ require 'test/unit' +require 'timeout' require 'tmpdir' class TestNotImplement < Test::Unit::TestCase @@ -20,13 +21,15 @@ class TestNotImplement < Test::Unit::TestCase 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) -- cgit v1.2.3