mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Run a TracePoint test in an insolated process
to prevent a random failure like http://ci.rvm.jp/results/trunk-random2@phosphorus-docker/3024287
This commit is contained in:
parent
5e860ed4c1
commit
ab62aa7037
1 changed files with 10 additions and 8 deletions
|
@ -2295,15 +2295,17 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
|
||||
def test_tracepoint_opt_invokebuiltin_delegate_leave
|
||||
code = 'puts RubyVM::InstructionSequence.of("\x00".method(:unpack)).disasm'
|
||||
out, _err, _status = EnvUtil.invoke_ruby(['-e', code], '', true)
|
||||
out = EnvUtil.invoke_ruby(['-e', code], '', true).first
|
||||
assert_match /^0000 opt_invokebuiltin_delegate_leave /, out
|
||||
|
||||
events = []
|
||||
TracePoint.new(:return) do |tp|
|
||||
events << [tp.event, tp.method_id]
|
||||
end.enable do
|
||||
"\x00".unpack("c")
|
||||
end
|
||||
assert_equal [[:return, :unpack]], events
|
||||
event = eval(EnvUtil.invoke_ruby(['-e', <<~'EOS'], '', true).first)
|
||||
set_trace_func(proc {}); set_trace_func(nil) # Is it okay that this is required?
|
||||
TracePoint.new(:return) do |tp|
|
||||
p [tp.event, tp.method_id]
|
||||
end.enable do
|
||||
"\x00".unpack("c")
|
||||
end
|
||||
EOS
|
||||
assert_equal [:return, :unpack], event
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue