Try to fix flaky GC test

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.
This commit is contained in:
Peter Zhu 2023-07-11 14:09:48 -04:00
parent 84d0667ea8
commit 7299c8c0f1
Notes: git 2023-07-11 19:05:29 +00:00

View File

@ -262,9 +262,12 @@ class TestGc < Test::Unit::TestCase
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