-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Description
We have a CI pipeline running via tart that by default checks out the repo at /var/tmp/builds/.... /var is in macOS just a symbolic link to /private/var. When the sources files are fetches via llvm-cov export it uses the exact path as used in the test run. In lib/slather/project.rb#L144 this is made absolute and undone of any symbolic links via realpath:
coverage_json["data"].reduce([]) do |result, chunk|
result.concat(chunk["files"].map do |file|
filename = file["filename"]
path = Pathname(filename)
# Don't crash if the file doesn't exist on disk.
# This may happen for autogenerated files that have been deleted.
filename = path.exist? ? path.realpath : filename
{"filename" => filename, "segments" => file["segments"]}
end)
endHowever, llvm-cov show requires the path as returned in llvm-cov export to filter correctly. This fixes it:
diff --git a/lib/slather/project.rb b/lib/slather/project.rb
index 8266192..ebf0ac7 100755
--- a/lib/slather/project.rb
+++ b/lib/slather/project.rb
@@ -141,7 +141,7 @@ module Slather
path = Pathname(filename)
# Don't crash if the file doesn't exist on disk.
# This may happen for autogenerated files that have been deleted.
- filename = path.exist? ? path.realpath : filename
+ filename = path.exist? ? path : filename
{"filename" => filename, "segments" => file["segments"]}
end)
endbut I am unsure about the implications in the rest of the library as realpath is used more. Perhaps this also explains #562.
Reproduce:
- clone slather in
/var/tmpand chdir into repo dir - run
bundle install - run
bundle exec rspec spec/slather/coverage_service/llvm_cov_spec.rb:32
RoySRodney
Metadata
Metadata
Assignees
Labels
No labels