aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_signal.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-19 07:47:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-19 07:47:12 +0000
commit4835230fef0005666e89fd1e2da5ad03ddb78315 (patch)
treeea99eaee3a04a5710f8a10900f76d637fb0069f1 /test/ruby/test_signal.rb
parentc4561c29348c357f50162cdd5c16d8b98d8cd0fa (diff)
downloadruby-4835230fef0005666e89fd1e2da5ad03ddb78315.tar.gz
test/ruby: reap zombies
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_signal.rb')
-rw-r--r--test/ruby/test_signal.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb
index 166ecc085c..fb07bffa9d 100644
--- a/test/ruby/test_signal.rb
+++ b/test/ruby/test_signal.rb
@@ -6,7 +6,7 @@ require_relative 'envutil'
class TestSignal < Test::Unit::TestCase
def have_fork?
begin
- Process.fork {}
+ Process.wait(Process.fork {})
return true
rescue NotImplementedError
return false
@@ -52,7 +52,6 @@ class TestSignal < Test::Unit::TestCase
end
def test_exit_action
- return unless have_fork? # skip this test
begin
r, w = IO.pipe
r0, w0 = IO.pipe
@@ -68,12 +67,17 @@ class TestSignal < Test::Unit::TestCase
sleep 0.1
assert_nothing_raised("[ruby-dev:26128]") {
Process.kill(:USR1, pid)
+ term = :TERM
begin
Timeout.timeout(3) {
Process.waitpid pid
}
rescue Timeout::Error
- Process.kill(:TERM, pid)
+ if term
+ Process.kill(term, pid)
+ term = (:KILL if term != :KILL)
+ retry
+ end
raise
end
}
@@ -195,6 +199,8 @@ class TestSignal < Test::Unit::TestCase
end
w.close
assert_equal(r.read, "foo")
+ ensure
+ Process.wait(pid) if pid
end
def test_signal_requiring