-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for llvm.coverage.json.export format #439
Conversation
@filipesperandio Hey, Filipe. Hope everything is well with you and your loved ones. Can you please take a look at the code and let me know if there is anything I need to rework? Thank you! |
@filipesperandio It works as described by @paulofaria, attaching screenshot. Got it working with
Couldn't get it to work with just |
could you @paulofaria got it to working using the |
@fede-moya Is there an error with the |
yeap, there is an error. swift-llvm-cov-test >> test-reporter after-build -t lcov-json
ERRO[0000] could not find coverage file
could not find any files in search paths for lcov-json. search paths were:
Error: could not find any files in search paths for lcov-json. search paths were:
Usage:
cc-test-reporter after-build [flags]
Flags:
-s, --batch-size int batch size for source files (default 500)
-e, --coverage-endpoint string endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
-t, --coverage-input-type string type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov]
--exit-code int exit code of the test run
-r, --id string reporter identifier (default "41241242141")
--insecure send coverage insecurely (without HTTPS)
-p, --prefix string the root directory where the coverage analysis was performed (default "/Users/federicomoya/Documents/repos/swift-llvm-cov-test")
Global Flags:
-d, --debug run in debug mode
|
Thanks @fede-moya . |
There is no default search paths for coverage files generated by the Swift Package Manager. As you can see I removed the default search path in this commit (the one I removed was a leftover from the formatter I used as a base for this formatter). The Swift Package Manager code coverage feature was designed to be used with |
Just inspected the directory of the code coverage file created by SwiftPM. Running the following command:
Gives us this output in my machine:
Inspecting the directory of the file with:
We get:
Does default search path support globbing? If so, we could try to match any |
I should warn that, since this approach assumes implementation details of SwiftPM, it is not future-proof. SwiftPM might change the directory and filename of the code coverage file. |
Looks like the CI error is unrelated to the changes in this PR.
|
@filipesperandio @paulofaria this commit fixes the CI. It should get merge soon. Considering that according to @paulofaria due to the specifics of swift the I think after the fix of the CI gets in, we could merge this one. WDYT @filipesperandio ? |
335bc35
to
916eb0c
Compare
@fede-moya @filipesperandio pinging you as you have been following this PR closer. The CI update did indeed fix the failing CI in this PR, do you think this is safe to merge or more steps are needed? |
Nice, I'm good with how it is now. The only thing would be for us to add a ticket to mention this new option in the docs, and it's particular use, like mentioning that there is no expected path. |
This PR adds support for the llvm.coverage.json.export format. This is the format generated by the Swift Package Manager. The commands below allow you to generate the coverage file:
The last command shows the path of the generated coverage file. I added a new formatter called
lcov-json
which can be used like so:test-reporter format-coverage $(swift test --show-codecov-path) -t lcov-json