From 0aa404b9573d028d87072f40ecb9b86dc161b7ef Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 30 Aug 2023 16:49:32 -0400 Subject: Change heap init environment variable names This commit changes RUBY_GC_HEAP_INIT_SIZE_{40,80,160,320,640}_SLOTS to RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS. This is easier to use because the user does not need to determine the slot sizes (which can vary between 32 and 64 bit systems). They now just use the heap names (`GC.stat_heap.keys`). --- test/ruby/test_gc.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 8fc511331e..3967ed54bc 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -377,17 +377,17 @@ class TestGc < Test::Unit::TestCase } assert_in_out_err([env, "-W0", "-e", "exit"], "", [], []) assert_in_out_err([env, "-W:deprecated", "-e", "exit"], "", [], - /The environment variable RUBY_GC_HEAP_INIT_SLOTS is deprecated; use environment variables RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS instead/) + /The environment variable RUBY_GC_HEAP_INIT_SLOTS is deprecated; use environment variables RUBY_GC_HEAP_%d_INIT_SLOTS instead/) env = {} - GC.stat_heap.each do |_, s| - env["RUBY_GC_HEAP_INIT_SIZE_#{s[:slot_size]}_SLOTS"] = "200000" + GC.stat_heap.keys.each do |heap| + env["RUBY_GC_HEAP_#{heap}_INIT_SLOTS"] = "200000" end assert_normal_exit("exit", "", :child_env => env) env = {} - GC.stat_heap.each do |_, s| - env["RUBY_GC_HEAP_INIT_SIZE_#{s[:slot_size]}_SLOTS"] = "0" + GC.stat_heap.keys.each do |heap| + env["RUBY_GC_HEAP_#{heap}_INIT_SLOTS"] = "0" end assert_normal_exit("exit", "", :child_env => env) @@ -456,8 +456,8 @@ class TestGc < Test::Unit::TestCase env = {} # Make the heap big enough to ensure the heap never needs to grow. sizes = GC.stat_heap.keys.reverse.map { |i| (i + 1) * 100_000 } - GC.stat_heap.each do |i, s| - env["RUBY_GC_HEAP_INIT_SIZE_#{s[:slot_size]}_SLOTS"] = sizes[i].to_s + GC.stat_heap.keys.each do |heap| + env["RUBY_GC_HEAP_#{heap}_INIT_SLOTS"] = sizes[heap].to_s end assert_separately([env, "-W0"], __FILE__, __LINE__, <<~RUBY) SIZES = #{sizes} -- cgit v1.2.3