summaryrefslogtreecommitdiff
path: root/test/ruby/test_gc.rb
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-10-06 13:46:31 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-10-06 13:46:31 -0400
commit3df904d1a8dc614589295dfdf30a781114b3a7fc (patch)
tree813db993ea6c647802d45ae671be1a6b50e748d4 /test/ruby/test_gc.rb
parent13e87e5049dd418e764f30a9cc45f787d239d466 (diff)
Add debug output to test_thrashing_for_young_objects
The test is failing only on trunk-repeat50@phosphorus-docker. This commit adds some debugging output to debug the failure.
Diffstat (limited to 'test/ruby/test_gc.rb')
-rw-r--r--test/ruby/test_gc.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index d2f1e21e33..d69d6dd06a 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -405,7 +405,7 @@ class TestGc < Test::Unit::TestCase
def test_thrashing_for_young_objects
# This test prevents bugs like [Bug #18929]
- assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-RUBY
+ assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'RUBY'
# Warmup to make sure heap stabilizes
1_000_000.times { Object.new }
@@ -419,12 +419,15 @@ class TestGc < Test::Unit::TestCase
after_stats = GC.stat
+ # Debugging output to for failures in trunk-repeat50@phosphorus-docker
+ debug_msg = "before_stats: #{before_stats}\nafter_stats: #{after_stats}"
+
# Should not be thrashing in page creation
- assert_equal before_stats[:heap_allocated_pages], after_stats[:heap_allocated_pages]
- assert_equal 0, after_stats[:heap_tomb_pages]
- assert_equal 0, after_stats[:total_freed_pages]
+ assert_equal before_stats[:heap_allocated_pages], after_stats[:heap_allocated_pages], debug_msg
+ assert_equal 0, after_stats[:heap_tomb_pages], debug_msg
+ assert_equal 0, after_stats[:total_freed_pages], debug_msg
# Only young objects, so should not trigger major GC
- assert_equal before_stats[:major_gc_count], after_stats[:major_gc_count]
+ assert_equal before_stats[:major_gc_count], after_stats[:major_gc_count], debug_msg
RUBY
end