-
Notifications
You must be signed in to change notification settings - Fork 11
/
run-hybrid-echidna.sh
executable file
·48 lines (47 loc) · 2.14 KB
/
run-hybrid-echidna.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
cd /daedaluzz
solc-select install 0.8.19
solc-select use 0.8.19
rm -rf hybrid-echidna-tmp/task-$1
mkdir hybrid-echidna-tmp/task-$1
cd hybrid-echidna-tmp/task-$1
rm -rf hybrid-echidna-corpus
mkdir hybrid-echidna-corpus
# Default settings:
# - seq-len: 10
# - test-limit: 50000
# - max-iters: unspecified
# - solver-timeout: unspecified
# - no-incremental: false
SEQ_LEN=100 # We also tried 30, but did not observe a significant change in performance. We use the default value for Echidna.
TEST_LIMIT='--test-limit 50000'
MAX_ITERS='--max-iters 3'
SOLVER_TIMEOUT=''
NO_INCREMENTAL=''
BRANCH_RECORD_PROB=''
SHRINK_LIMIT=5000 # We use the default value for Echidna.
CODE_SIZE='0xc00000'
printf 'shrinkLimit: %s\ncodeSize: %s\n' $SHRINK_LIMIT $CODE_SIZE > echidna-config.yaml
INIT_SEED=$4
RANDOM=$INIT_SEED
START_TIME=$(date +%s)
TIME_LIMIT=$2
END_TIME=$((START_TIME + TIME_LIMIT))
while true; do
NOW_TIME=$(date +%s)
echo "{\"timestamp\": $NOW_TIME}"
if [ $END_TIME -le $NOW_TIME ]; then
break
fi
SEED=$RANDOM
echo "{\"random-seed\": $SEED}"
REM_TIME=$((END_TIME - NOW_TIME))
# TERM='xterm-256color' timeout --foreground --preserve-status --kill-after 120 --signal SIGINT $REM_TIME hybrid-echidna /daedaluzz/generated-mazes/maze-$3.sol --config echidna-config.yaml --test-mode exploration --corpus-dir hybrid-echidna-corpus --contract Maze --seq-len $SEQ_LEN $TEST_LIMIT $MAX_ITERS $SOLVER_TIMEOUT $NO_INCREMENTAL $BRANCH_RECORD_PROB --seed $SEED > /dev/null 2>&1
TERM='xterm-256color' timeout --foreground --preserve-status --kill-after 120 --signal SIGINT $REM_TIME hybrid-echidna /daedaluzz/generated-mazes/maze-$3.sol --config echidna-config.yaml --test-mode exploration --corpus-dir hybrid-echidna-corpus --contract Maze --seq-len $SEQ_LEN $TEST_LIMIT $MAX_ITERS $SOLVER_TIMEOUT $NO_INCREMENTAL $BRANCH_RECORD_PROB --seed $SEED --no-display
grep "[*roe]\s*|\s*emit AssertionFailed" hybrid-echidna-corpus/covered.*.txt
TEST_LIMIT='--test-limit 500'
MAX_ITERS='--max-iters 1'
# SOLVER_TIMEOUT='--solver-timeout 5000'
NO_INCREMENTAL='--no-incremental'
# BRANCH_RECORD_PROB='--branch-record-prob "0.1"'
done