[前][次][番号順一覧][スレッド一覧]

ruby-changes:61688

From: Koichi <ko1@a...>
Date: Fri, 12 Jun 2020 17:38:47 +0900 (JST)
Subject: [ruby-changes:61688] e2678781c7 (master): prevent memory allocation for GC tests

https://git.ruby-lang.org/ruby.git/commit/?id=e2678781c7

From e2678781c739edb17f1744d35a9958146e880996 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
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.

diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index f18cd60..c2e075a 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -145,11 +145,15 @@ class TestGc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_gc.rb#L145
     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 v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]