From e2678781c739edb17f1744d35a9958146e880996 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 12 Jun 2020 17:28:58 +0900 Subject: prevent memory allocation for GC tests We observed test failures on test_latest_gc_info with random order CI. http://ci.rvm.jp/results/trunk-random1@phosphorus-docker/2998078l0ll To solve it, use a pre-allocated hash object and rehearsal. --- test/ruby/test_gc.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index f18cd60ba5..c2e075ab8d 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -145,11 +145,15 @@ class TestGc < Test::Unit::TestCase assert_equal :newobj, GC.latest_gc_info[:gc_by] eom + GC.latest_gc_info(h = {}) # allocate hash and rehearsal GC.start GC.start - assert_equal :force, GC.latest_gc_info[:major_by] if use_rgengc? - assert_equal :method, GC.latest_gc_info[:gc_by] - assert_equal true, GC.latest_gc_info[:immediate_sweep] + GC.start + GC.latest_gc_info(h) + + assert_equal :force, h[:major_by] if use_rgengc? + assert_equal :method, h[:gc_by] + assert_equal true, h[:immediate_sweep] GC.stress = true assert_equal :force, GC.latest_gc_info[:major_by] -- cgit v1.2.3