8000 `make test-all COVERAGE=true` supports directory-separated build · willnet/ruby@4a7bf2e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a7bf2e

Browse files
committed
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
1 parent 97d610b commit 4a7bf2e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tool/test-coverage.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,28 @@ def invoke_simplecov_formatter
7070
res = Marshal.load(File.binread(TEST_COVERAGE_DATA_FILE))
7171
simplecov_result = {}
7272
base_dir = File.dirname(__dir__)
73+
cur_dir = Dir.pwd
7374

7475
res.each do |path, cov|
75-
next unless path.start_with?(base_dir)
76+
next unless path.start_with?(base_dir) || path.start_with?(cur_dir)
7677
next if path.start_with?(File.join(base_dir, "test"))
7778
simplecov_result[path] = cov[:lines]
7879
end
7980

81+
a, b = base_dir, cur_dir
82+
until a == b
83+
if a.size > b.size
84+
a = File.dirname(a)
85+
else
86+
b = File.dirname(b)
87+
end
88+
end
89+
root_dir = a
90+
91+
SimpleCov.configure do
92+
root(root_dir)
93+
coverage_dir(File.join(cur_dir, "coverage"))
94+
end
8095
res = SimpleCov::Result.new(simplecov_result)
8196
res.command_name = "Ruby's `make test-all`"
8297
SimpleCov::Formatter::HTMLFormatter.new.format(res)

0 commit comments

Comments
 (0)
0