-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Generates a profile directory with profiles and outputs | ||
# from running each .sol file in a given examples directory | ||
|
||
# ARGUMENTS: | ||
# $1 - path to echidna-test to run, defaults to "echidna-test" | ||
# $2 - examples folder to profile, defaults to "examples" | ||
|
||
echidna=$1 | ||
if [ -z "$1" ]; then | ||
echidna="echidna-test" | ||
else | ||
echidna="$1" | ||
fi | ||
|
||
examples=$2 | ||
if [ -z "$2" ]; then | ||
examples="examples" | ||
else | ||
examples="$2" | ||
fi | ||
|
||
# prepare profiles folder and subfolders | ||
for dir in $(find "$examples" -type d); do | ||
mkdir -p "profiles/$dir" | ||
done | ||
|
||
# get number of total files | ||
# (there must be a better way to do this) | ||
declare -i totalFiles | ||
totalFiles=0 | ||
for file in $(find "$examples" -type f -name *.sol); do | ||
totalFiles+=1 | ||
done | ||
|
||
# profile each of the files | ||
declare -i doneFiles | ||
doneFiles=0 | ||
for file in $(find "$examples" -type f -name *.sol); do | ||
doneFiles+=1 | ||
echo "$doneFiles/$totalFiles - $file" | ||
# timeout 60 is because some of the files, eg examples/solidity/basic/propGasLimit.sol, can run infinitely | ||
timeout 60 "$1" "$file" --format none +RTS -p 2> "profiles/$file.otp" | ||
mv echidna-test.prof "profiles/$file.prof" | ||
done |