diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-05 01:05:16 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-05 01:05:16 +0000 |
commit | 63ef7776c54209ae197fc4a32dec86ffd00fa981 (patch) | |
tree | 68135382100ff5f2541a5f7c48e07152fb4af82e | |
parent | cf9ff56ac211b358b0a775b3367fd05a42b2f1fa (diff) | |
download | ruby-63ef7776c54209ae197fc4a32dec86ffd00fa981.tar.gz |
`make test-all COVERAGE=true` supports directory-separated build
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | tool/test-coverage.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tool/test-coverage.rb b/tool/test-coverage.rb index 7a27c5cfb4..e0d7dd06e1 100644 --- a/tool/test-coverage.rb +++ b/tool/test-coverage.rb @@ -70,13 +70,28 @@ def invoke_simplecov_formatter res = Marshal.load(File.binread(TEST_COVERAGE_DATA_FILE)) simplecov_result = {} base_dir = File.dirname(__dir__) + cur_dir = Dir.pwd res.each do |path, cov| - next unless path.start_with?(base_dir) + next unless path.start_with?(base_dir) || path.start_with?(cur_dir) next if path.start_with?(File.join(base_dir, "test")) simplecov_result[path] = cov[:lines] end + a, b = base_dir, cur_dir + until a == b + if a.size > b.size + a = File.dirname(a) + else + b = File.dirname(b) + end + end + root_dir = a + + SimpleCov.configure do + root(root_dir) + coverage_dir(File.join(cur_dir, "coverage")) + end res = SimpleCov::Result.new(simplecov_result) res.command_name = "Ruby's `make test-all`" SimpleCov::Formatter::HTMLFormatter.new.format(res) |