Skip to content

Commit

Permalink
Only try to turn on tracing via RubyVM if it exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Nov 3, 2014
1 parent 47b4623 commit 8dc1ed2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/mri/ruby/test_settracefunc.rb
Expand Up @@ -3,17 +3,21 @@

class TestSetTraceFunc < Test::Unit::TestCase
def setup
@original_compile_option = RubyVM::InstructionSequence.compile_option
RubyVM::InstructionSequence.compile_option = {
:trace_instruction => true,
:specialized_instruction => false
}
if defined?(RubyVM)
@original_compile_option = RubyVM::InstructionSequence.compile_option
RubyVM::InstructionSequence.compile_option = {
:trace_instruction => true,
:specialized_instruction => false
}
end
@target_thread = Thread.current
end

def teardown
set_trace_func(nil)
RubyVM::InstructionSequence.compile_option = @original_compile_option
if defined?(RubyVM)
RubyVM::InstructionSequence.compile_option = @original_compile_option
end
@target_thread = nil
end

Expand Down

0 comments on commit 8dc1ed2

Please sign in to comment.