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

ruby-changes:33235

From: nobu <ko1@a...>
Date: Tue, 11 Mar 2014 14:16:08 +0900 (JST)
Subject: [ruby-changes:33235] nobu:r45314 (trunk): envutil.rb: do not check RSS by default

nobu	2014-03-11 14:16:04 +0900 (Tue, 11 Mar 2014)

  New Revision: 45314

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45314

  Log:
    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.

  Modified files:
    trunk/test/dl/test_cptr.rb
    trunk/test/dl/test_handle.rb
    trunk/test/fiddle/test_handle.rb
    trunk/test/fiddle/test_pointer.rb
    trunk/test/ruby/envutil.rb
Index: test/ruby/envutil.rb
===================================================================
--- test/ruby/envutil.rb	(revision 45313)
+++ test/ruby/envutil.rb	(revision 45314)
@@ -390,7 +390,7 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L390
         assert_warning(*args) {$VERBOSE = false; yield}
       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'
         token = "\e[7;1m#{$$.to_s}:#{Time.now.strftime('%s.%L')}:#{rand(0x10000).to_s(16)}:\e[m"
         token_dump = token.dump
@@ -415,7 +415,7 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L415
         before = err.sub!(/^#{token_re}START=(\{.*\})\n/, '') && Memory::Status.parse($1)
         after = err.sub!(/^#{token_re}FINAL=(\{.*\})\n/, '') && Memory::Status.parse($1)
         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]
           a = after[n]
           next unless a > 0 and b > 0
Index: test/fiddle/test_pointer.rb
===================================================================
--- test/fiddle/test_pointer.rb	(revision 45313)
+++ test/fiddle/test_pointer.rb	(revision 45314)
@@ -232,7 +232,7 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_pointer.rb#L232
     end
 
     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 if defined?(Fiddle)
Index: test/fiddle/test_handle.rb
===================================================================
--- test/fiddle/test_handle.rb	(revision 45313)
+++ test/fiddle/test_handle.rb	(revision 45314)
@@ -190,7 +190,7 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_handle.rb#L190
     end if /freebsd/=~ RUBY_PLATFORM
 
     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 if defined?(Fiddle)
Index: test/dl/test_cptr.rb
===================================================================
--- test/dl/test_cptr.rb	(revision 45313)
+++ test/dl/test_cptr.rb	(revision 45314)
@@ -221,6 +221,6 @@ module DL https://github.com/ruby/ruby/blob/trunk/test/dl/test_cptr.rb#L221
   end
 
   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
Index: test/dl/test_handle.rb
===================================================================
--- test/dl/test_handle.rb	(revision 45313)
+++ test/dl/test_handle.rb	(revision 45314)
@@ -186,6 +186,6 @@ module DL https://github.com/ruby/ruby/blob/trunk/test/dl/test_handle.rb#L186
   end
 
   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

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

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