summaryrefslogtreecommitdiff
path: root/test/ruby/test_signal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_signal.rb')
-rw-r--r--test/ruby/test_signal.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb
index b8a20d945c..425dc26574 100644
--- a/test/ruby/test_signal.rb
+++ b/test/ruby/test_signal.rb
@@ -369,4 +369,24 @@ class TestSignal < Test::Unit::TestCase
ensure
trap(:CHLD, old) if Signal.list['CHLD']
end
+
+ def test_sigwait_fd_unused
+ t = EnvUtil.apply_timeout_scale(0.1)
+ assert_separately([], <<-End)
+ tgt = $$
+ trap(:TERM) { exit(0) }
+ e = "Process.daemon; sleep #{t * 2}; Process.kill(:TERM,\#{tgt})"
+ term = [ '#{EnvUtil.rubybin}', '--disable=gems', '-e', e ]
+ t2 = Thread.new { sleep } # grab sigwait_fd
+ Thread.pass until t2.stop?
+ Thread.new do
+ sleep #{t}
+ t2.kill
+ t2.join
+ end
+ Process.spawn(*term)
+ # last thread remaining, ensure it can react to SIGTERM
+ loop { sleep }
+ End
+ end if Process.respond_to?(:kill) && Process.respond_to?(:daemon)
end