mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_settracefunc.rb: ignore traces from another threads
because Kernel.set_trace_func affects other threads. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e1d1397af8
commit
633cebb0ef
2 changed files with 31 additions and 17 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue May 1 10:53:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/ruby/test_settracefunc.rb: ignore traces from another threads
|
||||||
|
because Kernel.set_trace_func affects other threads.
|
||||||
|
|
||||||
Tue May 1 06:04:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue May 1 06:04:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/digest/sha2/sha2.c (REVERSE32): exlicitly cast since unsigned
|
* ext/digest/sha2/sha2.c (REVERSE32): exlicitly cast since unsigned
|
||||||
|
|
|
@ -16,9 +16,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_c_call
|
def test_c_call
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
2: events << [event, lineno, mid, klass]
|
2: events << [event, lineno, mid, klass] if file == name
|
||||||
3: })
|
3: })
|
||||||
4: x = 1 + 1
|
4: x = 1 + 1
|
||||||
5: set_trace_func(nil)
|
5: set_trace_func(nil)
|
||||||
|
@ -40,9 +41,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_call
|
def test_call
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
2: events << [event, lineno, mid, klass]
|
2: events << [event, lineno, mid, klass] if file == name
|
||||||
3: })
|
3: })
|
||||||
4: def add(x, y)
|
4: def add(x, y)
|
||||||
5: x + y
|
5: x + y
|
||||||
|
@ -79,9 +81,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_class
|
def test_class
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
2: events << [event, lineno, mid, klass]
|
2: events << [event, lineno, mid, klass] if file == name
|
||||||
3: })
|
3: })
|
||||||
4: class Foo
|
4: class Foo
|
||||||
5: def bar
|
5: def bar
|
||||||
|
@ -131,9 +134,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_return # [ruby-dev:38701]
|
def test_return # [ruby-dev:38701]
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
2: events << [event, lineno, mid, klass]
|
2: events << [event, lineno, mid, klass] if file == name
|
||||||
3: })
|
3: })
|
||||||
4: def foo(a)
|
4: def foo(a)
|
||||||
5: return if a
|
5: return if a
|
||||||
|
@ -176,9 +180,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_return2 # [ruby-core:24463]
|
def test_return2 # [ruby-core:24463]
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
2: events << [event, lineno, mid, klass]
|
2: events << [event, lineno, mid, klass] if file == name
|
||||||
3: })
|
3: })
|
||||||
4: def foo
|
4: def foo
|
||||||
5: a = 5
|
5: a = 5
|
||||||
|
@ -214,9 +219,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_raise
|
def test_raise
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
2: events << [event, lineno, mid, klass]
|
2: events << [event, lineno, mid, klass] if file == name
|
||||||
3: })
|
3: })
|
||||||
4: begin
|
4: begin
|
||||||
5: raise TypeError, "error"
|
5: raise TypeError, "error"
|
||||||
|
@ -265,9 +271,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_break # [ruby-core:27606] [Bug #2610]
|
def test_break # [ruby-core:27606] [Bug #2610]
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
2: events << [event, lineno, mid, klass]
|
2: events << [event, lineno, mid, klass] if file == name
|
||||||
3: })
|
3: })
|
||||||
4: [1,2,3].any? {|n| n}
|
4: [1,2,3].any? {|n| n}
|
||||||
8: set_trace_func(nil)
|
8: set_trace_func(nil)
|
||||||
|
@ -306,7 +313,8 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
th = Thread.new do
|
th = Thread.new do
|
||||||
th = Thread.current
|
th = Thread.current
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: th.set_trace_func(prc)
|
1: th.set_trace_func(prc)
|
||||||
2: th.add_trace_func(prc2)
|
2: th.add_trace_func(prc2)
|
||||||
3: class ThreadTraceInnerClass
|
3: class ThreadTraceInnerClass
|
||||||
|
@ -357,11 +365,12 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_trace_defined_method
|
def test_trace_defined_method
|
||||||
events = []
|
events = []
|
||||||
eval <<-EOF.gsub(/^.*?: /, "")
|
name = "#{self.class}\##{__method__}"
|
||||||
|
eval <<-EOF.gsub(/^.*?: /, ""), nil, name
|
||||||
1: class FooBar; define_method(:foobar){}; end
|
1: class FooBar; define_method(:foobar){}; end
|
||||||
2: fb = FooBar.new
|
2: fb = FooBar.new
|
||||||
3: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
3: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
|
||||||
4: events << [event, lineno, mid, klass]
|
4: events << [event, lineno, mid, klass] if file == name
|
||||||
5: })
|
5: })
|
||||||
6: fb.foobar
|
6: fb.foobar
|
||||||
7: set_trace_func(nil)
|
7: set_trace_func(nil)
|
||||||
|
|
Loading…
Add table
Reference in a new issue