ruby-changes:34739
From: nobu <ko1@a...>
Date: Tue, 15 Jul 2014 17:05:15 +0900 (JST)
Subject: [ruby-changes:34739] nobu:r46822 (trunk): test/ruby/test_env.rb: test memory leaks only on Windows
nobu 2014-07-15 17:04:59 +0900 (Tue, 15 Jul 2014) New Revision: 46822 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46822 Log: test/ruby/test_env.rb: test memory leaks only on Windows * test/ruby/test_env.rb (test_memory_leak_{aset,select,shift}): test for Windows platform specific code. (test_memory_crash_select): ditto. Modified files: trunk/test/ruby/test_env.rb Index: test/ruby/test_env.rb =================================================================== --- test/ruby/test_env.rb (revision 46821) +++ test/ruby/test_env.rb (revision 46822) @@ -509,43 +509,45 @@ class TestEnv < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_env.rb#L509 end end - def test_memory_leak_aset - bug9977 = '[ruby-dev:48323] [Bug #9977]' - assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9977, limit: 2.0) - ENV.clear - k = 'FOO' - v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) - doit = proc {ENV[k] = v} - 500.times(&doit) - end; - end + if RUBY_PLATFORM =~ /bccwin|mswin|mingw/ + def test_memory_leak_aset + bug9977 = '[ruby-dev:48323] [Bug #9977]' + assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9977, limit: 2.0) + ENV.clear + k = 'FOO' + v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) + doit = proc {ENV[k] = v} + 500.times(&doit) + end; + end - def test_memory_leak_select - bug9978 = '[ruby-dev:48325] [Bug #9978]' - assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9978, limit: 2.0) - ENV.clear - k = 'FOO' - (ENV[k] = 'bar'*5000 rescue 'bar'*1500) - doit = proc {ENV.select {break}} - 500.times(&doit) - end; - end + def test_memory_leak_select + bug9978 = '[ruby-dev:48325] [Bug #9978]' + assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9978, limit: 2.0) + ENV.clear + k = 'FOO' + (ENV[k] = 'bar'*5000 rescue 'bar'*1500) + doit = proc {ENV.select {break}} + 500.times(&doit) + end; + end - def test_memory_crash_select - assert_normal_exit(<<-'end;') - 1000.times {ENV["FOO#{i}"] = 'bar'} - ENV.select {ENV.clear} - end; - end + def test_memory_crash_select + assert_normal_exit(<<-'end;') + 1000.times {ENV["FOO#{i}"] = 'bar'} + ENV.select {ENV.clear} + end; + end - def test_memory_leak_shift - bug9983 = '[ruby-dev:48332] [Bug #9983]' - assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9983, limit: 2.0) - ENV.clear - k = 'FOO' - v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) - doit = proc {ENV[k] = v; ENV.shift} - 500.times(&doit) - end; + def test_memory_leak_shift + bug9983 = '[ruby-dev:48332] [Bug #9983]' + assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9983, limit: 2.0) + ENV.clear + k = 'FOO' + v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) + doit = proc {ENV[k] = v; ENV.shift} + 500.times(&doit) + end; + end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/