From 878b0f18375db3812f3e55078b14ff943924d933 Mon Sep 17 00:00:00 2001 From: anishnaik Date: Wed, 16 Oct 2024 16:40:25 -0400 Subject: [PATCH] update coverage reports documentation (#493) --- docs/src/coverage_reports.md | 44 ---------------------- docs/src/project_configuration/overview.md | 2 +- docs/src/testing/coverage_reports.md | 42 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 45 deletions(-) delete mode 100644 docs/src/coverage_reports.md diff --git a/docs/src/coverage_reports.md b/docs/src/coverage_reports.md deleted file mode 100644 index 10920207..00000000 --- a/docs/src/coverage_reports.md +++ /dev/null @@ -1,44 +0,0 @@ -# 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`. diff --git a/docs/src/project_configuration/overview.md b/docs/src/project_configuration/overview.md index 898c6ee1..972bd0c7 100644 --- a/docs/src/project_configuration/overview.md +++ b/docs/src/project_configuration/overview.md @@ -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). diff --git a/docs/src/testing/coverage_reports.md b/docs/src/testing/coverage_reports.md index 408f8e18..c0441625 100644 --- a/docs/src/testing/coverage_reports.md +++ b/docs/src/testing/coverage_reports.md @@ -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`.