summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-13 11:41:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-13 11:41:57 +0000
commit05459d1a33db59c47e98e327c9f52808ebc76a3f (patch)
tree9cda5c7342db1004a507d09ba6be4d332e7ed5dd /test/ruby
parent6447d061f52178ba3cd5f8f463a0f7a46eee3a9a (diff)
vm_trace.c: defer interrupts while postponed jobs
* vm_trace.c (rb_postponed_job_flush): mask signal trap interrupt too to defer handling after finalizers finished. [ruby-core:66825] [Bug #10595] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_gc.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index ca57b69518..4bcf7593d2 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -331,6 +331,32 @@ class TestGc < Test::Unit::TestCase
end;
end
+ def test_interrupt_in_finalizer
+ bug10595 = '[ruby-core:66825] [Bug #10595]'
+ src = <<-'end;'
+ f = proc {1000.times {}}
+ loop do
+ ObjectSpace.define_finalizer(Object.new, f)
+ end
+ end;
+ error = nil
+ status = nil
+ EnvUtil.invoke_ruby(["-e", src], "", false, true) do |_, _, stderr, pid|
+ sleep 0.1
+ Process.kill("INT", pid)
+ th = Thread.start do
+ sleep 1
+ Process.kill("KILL", pid) rescue nil
+ end
+ error = stderr.read
+ _, status = Process.wait2(pid)
+ th.kill
+ end
+ assert_predicate status, :signaled?
+ assert_equal "INT", Signal.signame(status.termsig), bug10595
+ assert_match /Interrupt/, error, bug10595
+ end
+
def test_verify_internal_consistency
assert_nil(GC.verify_internal_consistency)
end