diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-06-12 17:28:58 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-06-12 17:32:49 +0900 |
commit | e2678781c739edb17f1744d35a9958146e880996 (patch) | |
tree | 8fe8f46e770db04b54c2dad979e2f6ea4b7476d2 /test/ruby | |
parent | 1f4db23ac1160bb73afb6d7dfd439ccb64d81bc2 (diff) |
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.
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_gc.rb | 10 |
1 files changed, 7 insertions, 3 deletions
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] |