Skip to content
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

Update coverage report documentation in mdbook #493

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.