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

ruby-changes:34366

From: ko1 <ko1@a...>
Date: Mon, 16 Jun 2014 18:45:16 +0900 (JST)
Subject: [ruby-changes:34366] ko1:r46447 (trunk): * test/runner.rb: capture TracePoint stat before setup and compare

ko1	2014-06-16 18:45:03 +0900 (Mon, 16 Jun 2014)

  New Revision: 46447

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

  Log:
    * test/runner.rb: capture TracePoint stat before setup and compare
      it after teardown.

  Modified files:
    trunk/ChangeLog
    trunk/test/runner.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46446)
+++ ChangeLog	(revision 46447)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun 16 18:42:57 2014  Koichi Sasada  <ko1@a...>
+
+	* test/runner.rb: capture TracePoint stat before setup and compare
+	  it after teardown.
+
 Mon Jun 16 14:33:56 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* process.c (open): use UTF-8 version function to support
Index: test/runner.rb
===================================================================
--- test/runner.rb	(revision 46446)
+++ test/runner.rb	(revision 46447)
@@ -19,18 +19,20 @@ require_relative 'profile_test_all' if E https://github.com/ruby/ruby/blob/trunk/test/runner.rb#L19
 
 module Test::Unit
   module ZombieHunter
-    @@zombie_traces = Hash.new(0)
+
+    def before_setup
+      @@tracepoint_captured_stat = TracePoint.stat.map{|k, (activated, deleted)| [k, activated]}
+    end
 
     def after_teardown
       super
       assert_empty(Process.waitall)
 
       # detect zombie traces.
-      TracePoint.stat.each{|key, (activated, deleted)|
-        old, @@zombie_traces[key] = @@zombie_traces[key], activated
-        assert_equal(old, activated, "The number of active trace events (#{key}) should not increase")
-        # puts "TracePoint - deleted: #{deleted}" if deleted > 0
-      }
+      assert_equal @@tracepoint_captured_stat, TracePoint.stat.map{|k, (activated, deleted)| [k, activated]} do
+        "The number of active trace events was changed"
+      end
+      # puts "TracePoint - deleted: #{deleted}" if deleted > 0
     end
   end
   class TestCase

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

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