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

ruby-changes:34481

From: hsbt <ko1@a...>
Date: Thu, 26 Jun 2014 18:17:03 +0900 (JST)
Subject: [ruby-changes:34481] hsbt:r46562 (trunk): * test/profile_test_all.rb: move into test library directory.

hsbt	2014-06-26 18:16:56 +0900 (Thu, 26 Jun 2014)

  New Revision: 46562

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

  Log:
    * test/profile_test_all.rb: move into test library directory.
    * test/runner.rb: fix require path for profile_test_all.rb.

  Added files:
    trunk/test/lib/profile_test_all.rb
  Removed files:
    trunk/test/profile_test_all.rb
  Modified files:
    trunk/ChangeLog
    trunk/test/runner.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46561)
+++ ChangeLog	(revision 46562)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 26 18:06:50 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* test/profile_test_all.rb: move into test library directory.
+	* test/runner.rb: fix require path for profile_test_all.rb.
+
 Thu Jun 26 17:57:57 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* lib/webrick/httpproxy.rb: remove useless assigned variables.
Index: test/profile_test_all.rb
===================================================================
--- test/profile_test_all.rb	(revision 46561)
+++ test/profile_test_all.rb	(revision 46562)
@@ -1,90 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/test/profile_test_all.rb#L0
-#
-# purpose:
-#  Profile memory usage of each tests.
-#
-# usage:
-#   RUBY_TEST_ALL_PROFILE=[file] make test-all
-#
-# output:
-#   [file] specified by RUBY_TEST_ALL_PROFILE
-#   If [file] is 'true', then it is ./test_all_profile
-#
-# collected information:
-#   - ObjectSpace.memsize_of_all
-#   - GC.stat
-#   - /proc/meminfo     (some fields, if exists)
-#   - /proc/self/status (some fields, if exists)
-#   - /proc/self/statm  (if exists)
-#
-
-require 'objspace'
-
-class MiniTest::Unit::TestCase
-  alias orig_run run
-
-  file = ENV['RUBY_TEST_ALL_PROFILE']
-  file = 'test-all-profile-result' if file == 'true'
-  TEST_ALL_PROFILE_OUT = open(file, 'w')
-  TEST_ALL_PROFILE_GC_STAT_HASH = {}
-  TEST_ALL_PROFILE_BANNER = ['name']
-  TEST_ALL_PROFILE_PROCS  = []
-
-  def self.add *name, &b
-    TEST_ALL_PROFILE_BANNER.concat name
-    TEST_ALL_PROFILE_PROCS << b
-  end
-
-  add 'failed?' do |result, tc|
-    result << (tc.passed? ? 0 : 1)
-  end
-
-  add 'memsize_of_all' do |result, *|
-    result << ObjectSpace.memsize_of_all
-  end
-
-  add *GC.stat.keys do |result, *|
-    GC.stat(TEST_ALL_PROFILE_GC_STAT_HASH)
-    result.concat TEST_ALL_PROFILE_GC_STAT_HASH.values
-  end
-
-  def self.add_proc_meminfo file, fields
-    return unless FileTest.exist?(file)
-    regexp = /(#{fields.join("|")}):\s*(\d+) kB/
-    # check = {}; fields.each{|e| check[e] = true}
-    add *fields do |result, *|
-      text = File.read(file)
-      text.scan(regexp){
-        # check.delete $1
-        result << $2
-        ''
-      }
-      # raise check.inspect unless check.empty?
-    end
-  end
-
-  add_proc_meminfo '/proc/meminfo', %w(MemTotal MemFree)
-  add_proc_meminfo '/proc/self/status', %w(VmPeak VmSize VmHWM VmRSS)
-
-  if FileTest.exist?('/proc/self/statm')
-    add *%w(size resident share text lib data dt) do |result, *|
-      result.concat File.read('/proc/self/statm').split(/\s+/)
-    end
-  end
-
-  def memprofile_test_all_result_result
-    result = ["#{self.class}\##{self.__name__.to_s.gsub(/\s+/, '')}"]
-    TEST_ALL_PROFILE_PROCS.each{|proc|
-      proc.call(result, self)
-    }
-    result.join("\t")
-  end
-
-  def run runner
-    result = orig_run(runner)
-    TEST_ALL_PROFILE_OUT.puts memprofile_test_all_result_result
-    TEST_ALL_PROFILE_OUT.flush
-    result
-  end
-
-  TEST_ALL_PROFILE_OUT.puts TEST_ALL_PROFILE_BANNER.join("\t")
-end
Index: test/runner.rb
===================================================================
--- test/runner.rb	(revision 46561)
+++ test/runner.rb	(revision 46562)
@@ -15,7 +15,7 @@ end https://github.com/ruby/ruby/blob/trunk/test/runner.rb#L15
 
 ENV["GEM_SKIP"] = ENV["GEM_HOME"] = ENV["GEM_PATH"] = "".freeze
 
-require_relative 'profile_test_all' if ENV.has_key?('RUBY_TEST_ALL_PROFILE')
+require_relative 'lib/profile_test_all' if ENV.has_key?('RUBY_TEST_ALL_PROFILE')
 require_relative 'lib/tracepointchecker'
 
 module Test::Unit
Index: test/lib/profile_test_all.rb
===================================================================
--- test/lib/profile_test_all.rb	(revision 0)
+++ test/lib/profile_test_all.rb	(revision 46562)
@@ -0,0 +1,90 @@ https://github.com/ruby/ruby/blob/trunk/test/lib/profile_test_all.rb#L1
+#
+# purpose:
+#  Profile memory usage of each tests.
+#
+# usage:
+#   RUBY_TEST_ALL_PROFILE=[file] make test-all
+#
+# output:
+#   [file] specified by RUBY_TEST_ALL_PROFILE
+#   If [file] is 'true', then it is ./test_all_profile
+#
+# collected information:
+#   - ObjectSpace.memsize_of_all
+#   - GC.stat
+#   - /proc/meminfo     (some fields, if exists)
+#   - /proc/self/status (some fields, if exists)
+#   - /proc/self/statm  (if exists)
+#
+
+require 'objspace'
+
+class MiniTest::Unit::TestCase
+  alias orig_run run
+
+  file = ENV['RUBY_TEST_ALL_PROFILE']
+  file = 'test-all-profile-result' if file == 'true'
+  TEST_ALL_PROFILE_OUT = open(file, 'w')
+  TEST_ALL_PROFILE_GC_STAT_HASH = {}
+  TEST_ALL_PROFILE_BANNER = ['name']
+  TEST_ALL_PROFILE_PROCS  = []
+
+  def self.add *name, &b
+    TEST_ALL_PROFILE_BANNER.concat name
+    TEST_ALL_PROFILE_PROCS << b
+  end
+
+  add 'failed?' do |result, tc|
+    result << (tc.passed? ? 0 : 1)
+  end
+
+  add 'memsize_of_all' do |result, *|
+    result << ObjectSpace.memsize_of_all
+  end
+
+  add *GC.stat.keys do |result, *|
+    GC.stat(TEST_ALL_PROFILE_GC_STAT_HASH)
+    result.concat TEST_ALL_PROFILE_GC_STAT_HASH.values
+  end
+
+  def self.add_proc_meminfo file, fields
+    return unless FileTest.exist?(file)
+    regexp = /(#{fields.join("|")}):\s*(\d+) kB/
+    # check = {}; fields.each{|e| check[e] = true}
+    add *fields do |result, *|
+      text = File.read(file)
+      text.scan(regexp){
+        # check.delete $1
+        result << $2
+        ''
+      }
+      # raise check.inspect unless check.empty?
+    end
+  end
+
+  add_proc_meminfo '/proc/meminfo', %w(MemTotal MemFree)
+  add_proc_meminfo '/proc/self/status', %w(VmPeak VmSize VmHWM VmRSS)
+
+  if FileTest.exist?('/proc/self/statm')
+    add *%w(size resident share text lib data dt) do |result, *|
+      result.concat File.read('/proc/self/statm').split(/\s+/)
+    end
+  end
+
+  def memprofile_test_all_result_result
+    result = ["#{self.class}\##{self.__name__.to_s.gsub(/\s+/, '')}"]
+    TEST_ALL_PROFILE_PROCS.each{|proc|
+      proc.call(result, self)
+    }
+    result.join("\t")
+  end
+
+  def run runner
+    result = orig_run(runner)
+    TEST_ALL_PROFILE_OUT.puts memprofile_test_all_result_result
+    TEST_ALL_PROFILE_OUT.flush
+    result
+  end
+
+  TEST_ALL_PROFILE_OUT.puts TEST_ALL_PROFILE_BANNER.join("\t")
+end

Property changes on: test/lib/profile_test_all.rb
___________________________________________________________________
Added: svn:eol-style
   + LF


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

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