Skip to content

Commit 878b0f1

Browse files
authored
update coverage reports documentation (#493)
1 parent c58a72f commit 878b0f1

File tree

3 files changed

+43
-45
lines changed

3 files changed

+43
-45
lines changed

docs/src/coverage_reports.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

docs/src/project_configuration/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ value to `10_000` or `100_000` depending on the use case. You can learn more abo
4343
Updating the corpus directory is optional but recommended. The corpus directory determines where corpus items should be
4444
stored on disk. A corpus item is a sequence of transactions that increased `medusa`'s coverage of the system. Thus, these
4545
corpus items are valuable to store so that they can be re-used for the next fuzzing campaign. Additionally, the directory
46-
will also hold [coverage reports](../coverage_reports.md) which is a valuable tool for debugging and validation. For most cases, you may set
46+
will also hold [coverage reports](../testing/coverage_reports.md) which is a valuable tool for debugging and validation. For most cases, you may set
4747
`corpusDirectory`'s value to "corpus". This will create a `corpus/` directory in the same directory as the `medusa.json`
4848
file.
4949
You can learn more about this option [here](./fuzzing_config.md#corpusdirectory).
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
11
## Coverage Reports
2+
3+
### Generating HTML Report from LCOV
4+
5+
Enable coverage reporting by setting the `corpusDirectory` key in the configuration file and setting the `coverageReports` key to `["lcov", "html"]`.
6+
7+
```json
8+
{
9+
"corpusDirectory": "corpus",
10+
"coverageReports": ["lcov", "html"]
11+
}
12+
```
13+
14+
### Install lcov and genhtml
15+
16+
Linux:
17+
18+
```bash
19+
apt-get install lcov
20+
```
21+
22+
MacOS:
23+
24+
```bash
25+
brew install lcov
26+
```
27+
28+
### Generate LCOV Report
29+
30+
```bash
31+
genhtml corpus/coverage/lcov.info --output-dir corpus --rc derive_function_end_line=0
32+
```
33+
34+
> [!WARNING]
35+
> ** The `derive_function_end_line` flag is required to prevent the `genhtml` tool from crashing when processing the Solidity source code. **
36+
37+
Open the `corpus/index.html` file in your browser or follow the steps to use VSCode below.
38+
39+
### View Coverage Report in VSCode with Coverage Gutters
40+
41+
Install the [Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters) extension.
42+
43+
Then, right click in a project file and select `Coverage Gutters: Display Coverage`.

0 commit comments

Comments
 (0)