зеркало из https://github.com/github/ruby.git
envutil.rb: do not check RSS by default
* test/ruby/envutil.rb (Test::Test#assert_no_memory_leak): do not check RSS by default, enabled by rss optional keyword argument. TestHash#test_exception_in_rehash sometimes fails otherwise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5543a55b52
Коммит
dc52725655
|
@ -221,6 +221,6 @@ module DL
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_memory_leak
|
def test_no_memory_leak
|
||||||
assert_no_memory_leak(%w[-W0 -rdl.so], '', '100_000.times {DL::CPtr.allocate}', limit: 1.2)
|
assert_no_memory_leak(%w[-W0 -rdl.so], '', '100_000.times {DL::CPtr.allocate}', limit: 1.2, rss: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -186,6 +186,6 @@ module DL
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_memory_leak
|
def test_no_memory_leak
|
||||||
assert_no_memory_leak(%w[-W0 -rdl.so], '', '100_000.times {DL::Handle.allocate}; GC.start', limit: 1.2)
|
assert_no_memory_leak(%w[-W0 -rdl.so], '', '100_000.times {DL::Handle.allocate}; GC.start', limit: 1.2, rss: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -190,7 +190,7 @@ module Fiddle
|
||||||
end if /freebsd/=~ RUBY_PLATFORM
|
end if /freebsd/=~ RUBY_PLATFORM
|
||||||
|
|
||||||
def test_no_memory_leak
|
def test_no_memory_leak
|
||||||
assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Handle.allocate}; GC.start', limit: 1.2)
|
assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Handle.allocate}; GC.start', limit: 1.2, rss: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end if defined?(Fiddle)
|
end if defined?(Fiddle)
|
||||||
|
|
|
@ -232,7 +232,7 @@ module Fiddle
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_memory_leak
|
def test_no_memory_leak
|
||||||
assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Pointer.allocate}', limit: 1.2)
|
assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Pointer.allocate}', limit: 1.2, rss: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end if defined?(Fiddle)
|
end if defined?(Fiddle)
|
||||||
|
|
|
@ -390,7 +390,7 @@ eom
|
||||||
assert_warning(*args) {$VERBOSE = false; yield}
|
assert_warning(*args) {$VERBOSE = false; yield}
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_no_memory_leak(args, prepare, code, message=nil, limit: 1.5, **opt)
|
def assert_no_memory_leak(args, prepare, code, message=nil, limit: 1.5, rss: false, **opt)
|
||||||
require_relative 'memory_status'
|
require_relative 'memory_status'
|
||||||
token = "\e[7;1m#{$$.to_s}:#{Time.now.strftime('%s.%L')}:#{rand(0x10000).to_s(16)}:\e[m"
|
token = "\e[7;1m#{$$.to_s}:#{Time.now.strftime('%s.%L')}:#{rand(0x10000).to_s(16)}:\e[m"
|
||||||
token_dump = token.dump
|
token_dump = token.dump
|
||||||
|
@ -415,7 +415,7 @@ eom
|
||||||
before = err.sub!(/^#{token_re}START=(\{.*\})\n/, '') && Memory::Status.parse($1)
|
before = err.sub!(/^#{token_re}START=(\{.*\})\n/, '') && Memory::Status.parse($1)
|
||||||
after = err.sub!(/^#{token_re}FINAL=(\{.*\})\n/, '') && Memory::Status.parse($1)
|
after = err.sub!(/^#{token_re}FINAL=(\{.*\})\n/, '') && Memory::Status.parse($1)
|
||||||
assert_equal([true, ""], [status.success?, err], message)
|
assert_equal([true, ""], [status.success?, err], message)
|
||||||
([:size, :rss] & after.members).each do |n|
|
([:size, (rss && :rss)] & after.members).each do |n|
|
||||||
b = before[n]
|
b = before[n]
|
||||||
a = after[n]
|
a = after[n]
|
||||||
next unless a > 0 and b > 0
|
next unless a > 0 and b > 0
|
||||||
|
|
Загрузка…
Ссылка в новой задаче