Skip to content

Commit

Permalink
Add autogenerate profiles script
Browse files Browse the repository at this point in the history
  • Loading branch information
samalws committed Dec 21, 2021
1 parent f0f20de commit 49c8cd0
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions autogenProfiles
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

0 comments on commit 49c8cd0

Please sign in to comment.