From 640d675e5d2bcdffdd4ded9e3cde8ba7b47fea6c Mon Sep 17 00:00:00 2001 From: bohendo Date: Fri, 29 Mar 2024 16:39:35 -0400 Subject: [PATCH] upgrade slither-mutate readme --- slither/tools/mutator/README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/slither/tools/mutator/README.md b/slither/tools/mutator/README.md index 8af977b08..aa4d86655 100644 --- a/slither/tools/mutator/README.md +++ b/slither/tools/mutator/README.md @@ -2,15 +2,24 @@ `slither-mutate` is a mutation testing tool for solidity based smart contracts. -## Usage +## Quick Start -`slither-mutate --test-cmd ` +In a foundry project with **passing** tests that are run with `forge test`, you can mutate all solidity files in the `src` folder by running the following: -To view the list of mutators available `slither-mutate --list-mutators` +`slither-mutate src --test-cmd='forge test'` + +You can provide flags to `forge` as part of the `--test-cmd` parameter or target a single file path instead of the whole `src` directory, for example: + +`slither-mutate src/core/MyContract.sol --test-cmd='forge test --match-contract="MyContract"'` ### CLI Interface ```shell +$ slither-mutate --help +usage: slither-mutate --test-cmd + +Experimental smart contract mutator. Based on https://arxiv.org/abs/2006.11597 + positional arguments: codebase Codebase to analyze (.sol file, project directory, ...) @@ -24,10 +33,11 @@ options: --timeout TIMEOUT Set timeout for test command (by default 30 seconds) --output-dir OUTPUT_DIR Name of output directory (by default 'mutation_campaign') - --verbose output all mutants generated + -v, --verbose log mutants that are caught as well as those that are uncaught + -vv, --very-verbose log mutants that are caught, uncaught, and fail to compile. And more! --mutators-to-run MUTATORS_TO_RUN mutant generators to run --contract-names CONTRACT_NAMES list of contract names you want to mutate - --quick to stop full mutation if revert mutator passes + --comprehensive continue testing minor mutations if severe mutants are uncaught ```