mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Revamp method coverage to support define_method
Traditionally, method coverage measurement was implemented by inserting `trace2` instruction to the head of method iseq. So, it just measured methods defined by `def` keyword. This commit drastically changes the measuring mechanism of method coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t* to runs (i.e., it counts the runs per method entry), and at `Coverage.result`, it creates the result hash by enumerating all `rb_method_entry_t*` objects (by `ObjectSpace.each_object`). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aa87ae7a04
commit
0a6816ecd7
11 changed files with 285 additions and 81 deletions
|
@ -87,15 +87,15 @@ def gen_rb_lcov(file)
|
|||
|
||||
# function coverage
|
||||
total = covered = 0
|
||||
cov[:methods].each do |(name, _, lineno), count|
|
||||
f.puts "FN:#{ lineno },#{ name }"
|
||||
cov[:methods].each do |(klass, name, lineno), count|
|
||||
f.puts "FN:#{ lineno },#{ klass }##{ name }"
|
||||
total += 1
|
||||
covered += 1 if count > 0
|
||||
end
|
||||
f.puts "FNF:#{ total }"
|
||||
f.puts "FNF:#{ covered }"
|
||||
cov[:methods].each do |(name, _), count|
|
||||
f.puts "FNDA:#{ count },#{ name }"
|
||||
cov[:methods].each do |(klass, name, _), count|
|
||||
f.puts "FNDA:#{ count },#{ klass }##{ name }"
|
||||
end
|
||||
|
||||
# line coverage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue