ruby-changes:31189
From: nobu <ko1@a...>
Date: Sun, 13 Oct 2013 12:16:57 +0900 (JST)
Subject: [ruby-changes:31189] nobu:r43268 (trunk): test_notimp.rb: test timeout
nobu 2013-10-13 12:16:50 +0900 (Sun, 13 Oct 2013) New Revision: 43268 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43268 Log: test_notimp.rb: test timeout * test/ruby/test_notimp.rb (test_call_fork): test timeout directly. Modified files: trunk/test/ruby/test_notimp.rb Index: test/ruby/test_notimp.rb =================================================================== --- test/ruby/test_notimp.rb (revision 43267) +++ test/ruby/test_notimp.rb (revision 43268) @@ -23,26 +23,28 @@ class TestNotImplement < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_notimp.rb#L23 def test_call_fork GC.start pid = nil - begin - Timeout.timeout(5) { - pid = fork {} - Process.wait pid - pid = nil - } - rescue Timeout::Error + ps = case RUBY_PLATFORM when /linux/ # assume Linux Distribution uses procps - ps = `ps -eLf #{pid}` + proc {`ps -eLf #{pid}`} when /freebsd/ - ps = `ps -lH #{pid}` + proc {`ps -lH #{pid}`} when /darwin/ - ps = `ps -lM #{pid}` + proc {`ps -lM #{pid}`} else - ps = `ps -l #{pid}` + proc {`ps -l #{pid}`} end + assert_nothing_raised(Timeout::Error, ps) do + Timeout.timeout(5) { + pid = fork {} + Process.wait pid + pid = nil + } + end + ensure + if pid Process.kill(:KILL, pid) Process.wait pid - assert_equal nil, pid, ps end end if Process.respond_to?(:fork) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/