aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_gc.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-30 06:14:37 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-30 06:14:37 +0000
commit4369806ff0ef10833f31897ae97527079d56897f (patch)
tree6de60c25721ed928a9ddd8b93c6a4dbaf859e1a6 /test/ruby/test_gc.rb
parent989373b243efb51c1c8e6d3880a0614cd9733a10 (diff)
downloadruby-4369806ff0ef10833f31897ae97527079d56897f.tar.gz
* gc.c: support `USE_RGENGC == 0'.
* test/ruby/test_gc.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_gc.rb')
-rw-r--r--test/ruby/test_gc.rb31
1 files changed, 20 insertions, 11 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 5181e9db9f..5b75e0f9bf 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -35,6 +35,10 @@ class TestGc < Test::Unit::TestCase
GC.stress = prev_stress
end
+ def use_rgengc?
+ GC::OPTS.include? 'USE_RGENGC'.freeze
+ end
+
def test_enable_disable
GC.enable
assert_equal(false, GC.enable)
@@ -49,6 +53,8 @@ class TestGc < Test::Unit::TestCase
end
def test_start_full_mark
+ return unless use_rgengc?
+
GC.start(full_mark: false)
assert_nil GC.latest_gc_info(:major_by)
@@ -112,7 +118,7 @@ class TestGc < Test::Unit::TestCase
assert_equal :newobj, GC.latest_gc_info[:gc_by]
GC.start
- assert_equal :nofree, GC.latest_gc_info[:major_by]
+ assert_equal :nofree, 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]
@@ -190,8 +196,9 @@ class TestGc < Test::Unit::TestCase
}
assert_normal_exit("exit", "", :child_env => env)
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=0\.9/, "")
+
# always full GC when RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR < 1.0
- assert_in_out_err([env, "-e", "1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "")
+ assert_in_out_err([env, "-e", "1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "") if use_rgengc?
# check obsolete
assert_in_out_err([{'RUBY_FREE_MIN' => '100'}, '-w', '-eexit'], '', [],
@@ -209,15 +216,17 @@ class TestGc < Test::Unit::TestCase
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_MALLOC_LIMIT_MAX=16000000/, "")
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=2.0/, "")
- env = {
- "RUBY_GC_OLDMALLOC_LIMIT" => "60000000",
- "RUBY_GC_OLDMALLOC_LIMIT_MAX" => "160000000",
- "RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR" => "2.0"
- }
- assert_normal_exit("exit", "", :child_env => env)
- assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT=6000000/, "")
- assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT_MAX=16000000/, "")
- assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=2.0/, "")
+ if use_rgengc?
+ env = {
+ "RUBY_GC_OLDMALLOC_LIMIT" => "60000000",
+ "RUBY_GC_OLDMALLOC_LIMIT_MAX" => "160000000",
+ "RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR" => "2.0"
+ }
+ assert_normal_exit("exit", "", :child_env => env)
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT=6000000/, "")
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT_MAX=16000000/, "")
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=2.0/, "")
+ end
end
def test_profiler_enabled