From c1b412c58915ea39201f6cf409d401461999c94a Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 30 Jan 2023 17:44:34 +0100 Subject: [PATCH] [fuzzing] allow fuzz.sh to be called from any directory --- fuzzing/echidna.yaml | 1 - fuzzing/fuzz.sh | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fuzzing/echidna.yaml b/fuzzing/echidna.yaml index f6a15af..b2cb8ff 100644 --- a/fuzzing/echidna.yaml +++ b/fuzzing/echidna.yaml @@ -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 diff --git a/fuzzing/fuzz.sh b/fuzzing/fuzz.sh index f030ccf..d7cb9ca 100755 --- a/fuzzing/fuzz.sh +++ b/fuzzing/fuzz.sh @@ -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" }