Skip to content

Commit

Permalink
update coverage reports documentation (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
anishnaik authored Oct 16, 2024
1 parent c58a72f commit 878b0f1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 45 deletions.
44 changes: 0 additions & 44 deletions docs/src/coverage_reports.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/project_configuration/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ value to `10_000` or `100_000` depending on the use case. You can learn more abo
Updating the corpus directory is optional but recommended. The corpus directory determines where corpus items should be
stored on disk. A corpus item is a sequence of transactions that increased `medusa`'s coverage of the system. Thus, these
corpus items are valuable to store so that they can be re-used for the next fuzzing campaign. Additionally, the directory
will also hold [coverage reports](../coverage_reports.md) which is a valuable tool for debugging and validation. For most cases, you may set
will also hold [coverage reports](../testing/coverage_reports.md) which is a valuable tool for debugging and validation. For most cases, you may set
`corpusDirectory`'s value to "corpus". This will create a `corpus/` directory in the same directory as the `medusa.json`
file.
You can learn more about this option [here](./fuzzing_config.md#corpusdirectory).
42 changes: 42 additions & 0 deletions docs/src/testing/coverage_reports.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
## Coverage Reports

### 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`.

0 comments on commit 878b0f1

Please sign in to comment.