Change test_warmup_frees_pages to check each size pool

This should help in debugging the intermittent test failures on CI:

    TestProcess#test_warmup_frees_pages [test/ruby/test_process.rb:2779]:
    <201> expected but was
    <202>.
This commit is contained in:
Peter Zhu 2023-12-29 22:14:38 -05:00
parent 606c01727a
commit 8e32c01742

View File

@ -2771,12 +2771,14 @@ EOS
# Disable GC so we can make sure GC only runs in Process.warmup
GC.disable
total_pages_before = GC.stat(:heap_eden_pages) + GC.stat(:heap_allocatable_pages)
total_pages_before = GC.stat_heap.map { |_, v| v[:heap_eden_pages] + v[:heap_allocatable_pages] }
Process.warmup
# Number of pages freed should cause equal increase in number of allocatable pages.
assert_equal(total_pages_before, GC.stat(:heap_eden_pages) + GC.stat(:heap_allocatable_pages))
total_pages_before.each_with_index do |val, i|
assert_equal(val, GC.stat_heap(i, :heap_eden_pages) + GC.stat_heap(i, :heap_allocatable_pages), "size pool: #{i}")
end
assert_equal(0, GC.stat(:heap_tomb_pages))
assert_operator(GC.stat(:total_freed_pages), :>, 0)
end;