summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-07-11 14:09:48 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-07-11 15:05:10 -0400
commit7299c8c0f165247853fac2fe337e7c2678e653c9 (patch)
tree85d4aa92d59eee077e658b7c9b484c10d227eaaa
parent84d0667ea8211fad830e744ab9cacd3f1770395d (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8055
-rw-r--r--test/ruby/test_gc.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 0f4a13211e..7650c68eca 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -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