-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: produce LCOV-style coverage report * add function metadata to LCOV * consider at least one line hit as function coverage * add coverage report config to select between lcov and html * add default path * lint * fix whitespace in default * rename to coverageFormats --------- Co-authored-by: Anish Naik <anish.naik@trailofbits.com>
- Loading branch information
1 parent
fc59d39
commit e018eb3
Showing
11 changed files
with
364 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,44 @@ | ||
# Coverage Reports | ||
|
||
WIP | ||
## Generating HTML Report from LCOV | ||
|
||
Enable coverage reporting by setting the `corpusDirectory` key in the configuration file and setting the `coverageReports` key to `["lcov", "html"]`. | ||
|
||
```json | ||
{ | ||
"corpusDirectory": "corpus", | ||
"coverageReports": ["lcov", "html"] | ||
} | ||
``` | ||
|
||
### Install lcov and genhtml | ||
|
||
Linux: | ||
|
||
```bash | ||
apt-get install lcov | ||
``` | ||
|
||
MacOS: | ||
|
||
```bash | ||
brew install lcov | ||
``` | ||
|
||
### Generate LCOV Report | ||
|
||
```bash | ||
|
||
genhtml corpus/coverage/lcov.info --output-dir corpus --rc derive_function_end_line=0 | ||
``` | ||
|
||
> [!WARNING] | ||
> ** The `derive_function_end_line` flag is required to prevent the `genhtml` tool from crashing when processing the Solidity source code. ** | ||
Open the `corpus/index.html` file in your browser or follow the steps to use VSCode below. | ||
|
||
### View Coverage Report in VSCode with Coverage Gutters | ||
|
||
Install the [Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters) extension. | ||
|
||
Then, right click in a project file and select `Coverage Gutters: Display Coverage`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.