diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/-ext-/tracepoint/test_tracepoint.rb | 21 | ||||
-rw-r--r-- | test/objspace/test_objspace.rb | 19 |
2 files changed, 21 insertions, 19 deletions
diff --git a/test/-ext-/tracepoint/test_tracepoint.rb b/test/-ext-/tracepoint/test_tracepoint.rb index 9743a15510..dccde1dd77 100644 --- a/test/-ext-/tracepoint/test_tracepoint.rb +++ b/test/-ext-/tracepoint/test_tracepoint.rb @@ -1,5 +1,6 @@ require 'test/unit' require '-test-/tracepoint' +require_relative '../../ruby/envutil' class TestTracepointObj < Test::Unit::TestCase def test_not_available_from_ruby @@ -56,4 +57,24 @@ class TestTracepointObj < Test::Unit::TestCase def test_tracepoint_specify_normal_and_internal_events assert_raise(TypeError){ Bug.tracepoint_specify_normal_and_internal_events } end + + def test_after_gc_start_hook_with_GC_stress + bug8492 = '[ruby-dev:47400] [Bug #8492]: infinite after_gc_start_hook reentrance' + assert_nothing_raised(Timeout::Error, bug8492) do + assert_in_out_err(%w[-r-test-/tracepoint], <<-'end;', /\A[1-9]/, timeout: 2) + stress, GC.stress = GC.stress, false + count = 0 + Bug.after_gc_start_hook = proc {count += 1} + begin + GC.stress = true + 3.times {Object.new} + ensure + GC.stress = stress + Bug.after_gc_start_hook = nil + end + puts count + end; + end + end + end diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 83cd6d3ca0..f8d1c405e8 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -193,25 +193,6 @@ class TestObjSpace < Test::Unit::TestCase assert_equal(nil, ObjectSpace.allocation_sourcefile(obj3)) end - def test_after_gc_start_hook_with_GC_stress - bug8492 = '[ruby-dev:47400] [Bug #8492]: infinite after_gc_start_hook reentrance' - assert_nothing_raised(Timeout::Error, bug8492) do - assert_in_out_err(%w[-robjspace], <<-'end;', /\A[1-9]/, timeout: 2) - stress, GC.stress = GC.stress, false - count = 0 - ObjectSpace.after_gc_start_hook = proc {count += 1} - begin - GC.stress = true - 3.times {Object.new} - ensure - GC.stress = stress - ObjectSpace.after_gc_start_hook = nil - end - puts count - end; - end - end - def test_dump_to_default line = nil info = nil |