2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2013-12-09 17:50:44 -05:00
|
|
|
require_relative 'helper'
|
|
|
|
|
|
|
|
module DTrace
|
|
|
|
class TestMethodCacheClear < TestCase
|
|
|
|
def test_method_cache_clear
|
|
|
|
trap_probe(probe, <<-code) do |_,rbfile,lines|
|
|
|
|
class String; end
|
|
|
|
class String; def abc() end end
|
|
|
|
class Object; def abc() end end
|
|
|
|
code
|
2016-07-26 08:51:50 -04:00
|
|
|
assert_not_include lines, "String #{rbfile} 1\n"
|
|
|
|
assert_include lines, "String #{rbfile} 2\n"
|
|
|
|
assert_include lines, "global #{rbfile} 3\n"
|
2013-12-09 17:50:44 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def probe
|
|
|
|
<<-eoprobe
|
|
|
|
ruby$target:::method-cache-clear
|
2018-06-05 17:19:40 -04:00
|
|
|
/arg1 && arg2/
|
2013-12-09 17:50:44 -05:00
|
|
|
{
|
|
|
|
printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2);
|
|
|
|
}
|
|
|
|
eoprobe
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end if defined?(DTrace::TestCase)
|