Skip to content

Commit

Permalink
Try to fix flaky GC test
Browse files Browse the repository at this point in the history
assert_not_nil could allocate objects which may trigger the major GC, so
don't run the assertions until the major GC has been ran.
  • Loading branch information
peterzhu2118 authored and jhawthorn committed Oct 30, 2023
1 parent cdb85d2 commit eac197c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/ruby/test_gc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,12 @@ def test_latest_gc_info_need_major_by
objects.append(100.times.map { '*' })
end

assert_not_nil GC.latest_gc_info(:need_major_by)
need_major_by = GC.latest_gc_info(:need_major_by)
GC.start(full_mark: false) # should be upgraded to major
assert_not_nil GC.latest_gc_info(:major_by)
major_by = GC.latest_gc_info(:major_by)

assert_not_nil(need_major_by)
assert_not_nil(major_by)
end

def test_stress_compile_send
Expand Down

0 comments on commit eac197c

Please sign in to comment.