diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2023-12-18 13:30:24 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2023-12-18 19:25:37 -0500 |
| commit | ce436ff3e3cbd6810d7cf83fedbd2b55995ca0b1 (patch) | |
| tree | 89226c5e4b002a977264ac157d6be010605b86bf /test | |
| parent | 3c471149910d79745b50389c436f0ed2973e0d91 (diff) | |
Fix flaky test test_stat_heap
The test sometimes fails with:
1) Failure:
TestGc#test_stat_heap [/tmp/ruby/src/trunk-repeat50/test/ruby/test_gc.rb:169]:
Expected 33434403 to be <= 33434354.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ruby/test_gc.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 5111b05001..a577fcb16b 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -151,8 +151,13 @@ class TestGc < Test::Unit::TestCase GC.stat(stat) GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i| - GC.stat_heap(i, stat_heap) - GC.stat(stat) + begin + reenable_gc = !GC.disable + GC.stat_heap(i, stat_heap) + GC.stat(stat) + ensure + GC.enable if reenable_gc + end assert_equal GC::INTERNAL_CONSTANTS[:RVALUE_SIZE] * (2**i), stat_heap[:slot_size] assert_operator stat_heap[:heap_allocatable_pages], :<=, stat[:heap_allocatable_pages] |
