ruby-changes:50890
From: mame <ko1@a...>
Date: Thu, 5 Apr 2018 10:05:21 +0900 (JST)
Subject: [ruby-changes:50890] mame:r63097 (trunk): `make test-all COVERAGE=true` supports directory-separated build
mame 2018-04-05 10:05:16 +0900 (Thu, 05 Apr 2018) New Revision: 63097 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63097 Log: `make test-all COVERAGE=true` supports directory-separated build Modified files: trunk/tool/test-coverage.rb Index: tool/test-coverage.rb =================================================================== --- tool/test-coverage.rb (revision 63096) +++ tool/test-coverage.rb (revision 63097) @@ -70,13 +70,28 @@ def invoke_simplecov_formatter https://github.com/ruby/ruby/blob/trunk/tool/test-coverage.rb#L70 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/