[fuzzing] allow fuzz.sh to be called from any directory

This commit is contained in:
Mark Spanbroek 2023-01-30 17:44:34 +01:00 committed by markspanbroek
parent 25f52c72b1
commit c1b412c589
2 changed files with 7 additions and 4 deletions

View File

@ -2,5 +2,4 @@
testMode: "assertion" # check that solidity asserts are never triggered
multi-abi: true # allow calls to e.g. TestToken in test scenarios
corpusDir: "fuzzing/corpus" # collect coverage maximizing corpus in this dir
format: "text" # disable interactive ui

View File

@ -1,20 +1,24 @@
#!/bin/bash
set -e
root=$(cd $(dirname "$0")/.. && pwd)
if command -v echidna-test; then
fuzz () {
echidna-test . \
--config fuzzing/echidna.yaml \
echidna-test ${root} \
--config ${root}/fuzzing/echidna.yaml \
--corpus-dir ${root}/fuzzing/corpus \
--contract $1
}
else
fuzz () {
docker run \
--rm \
-v `pwd`:/src ghcr.io/crytic/echidna/echidna \
-v ${root}:/src ghcr.io/crytic/echidna/echidna \
bash -c \
"cd /src && echidna-test . \
--config fuzzing/echidna.yaml \
--corpus-dir fuzzing/corpus \
--crytic-args --ignore-compile \
--contract $1"
}