1
1
#! /bin/bash
2
2
# Experiment script. Copy to "<cbmc_workspace>/regression/". Use as follows:
3
- # ./run-danger.sh [cegis|cegis-no-ranking] [cegis/cegis_danger_benchmark_<benchmark_id>]
3
+ # ./run-danger.sh [cegis|cegis-no-ranking]
4
4
5
5
defaultArgs=' --cegis-statistics --cegis-genetic main.c'
6
- cegisOut=' main.cegis.out'
7
- cegisHeadStartOut=' main.cegis-symex-head-start.out'
8
- cegisTournamentOut=' main.cegis-tournament-select.out'
9
- cegisHeadStartTournamentOut=' main.cegis-symex-head-start-tournament-select.out'
10
- config5Out=' main.cegis-config5.out'
11
- config6Out=' main.cegis-config6.out'
12
- config7Out=' main.cegis-config7.out'
13
- config8Out=' main.cegis-config8.out'
6
+ config1Out=' main.cegis-config1.out'
7
+ config2Out=' main.cegis-config2.out'
8
+ config3Out=' main.cegis-config3.out'
9
+ config4Out=' main.cegis-config4.out'
14
10
successValue=' </stats>'
15
11
baseDir=` pwd`
16
12
17
13
trap ' ' SIGTERM
18
14
15
+ config_input=$1
16
+ if [ -z " $1 " ]; then config_input=' cegis' ; fi
17
+
19
18
for config in $1 ; do
20
19
resultFile=" ${baseDir} /${config} .txt"
21
20
truncate -s 0 " ${resultFile} "
22
- for benchmark in ${baseDir} /$2 ; do
21
+ for benchmark in ${baseDir} /cegis/cegis_danger_benchmark_ * ; do
23
22
echo " ${benchmark} "
24
23
cd " ${benchmark} "
25
24
echo -n ` basename ${benchmark} ` >> " ${resultFile} "
@@ -33,113 +32,56 @@ for config in $1; do
33
32
benchmarkArgs=" --danger ${benchmarkArgs} "
34
33
fi
35
34
36
- truncate -s 0 ${cegisOut}
37
- truncate -s 0 ${cegisHeadStartOut}
38
- truncate -s 0 ${cegisTournamentOut}
39
- truncate -s 0 ${cegisHeadStartTournamentOut}
40
- truncate -s 0 ${config5Out}
41
- truncate -s 0 ${config6Out}
42
- truncate -s 0 ${config7Out}
43
- truncate -s 0 ${config8Out}
35
+ truncate -s 0 ${config1Out}
36
+ truncate -s 0 ${config2Out}
37
+ truncate -s 0 ${config3Out}
38
+ truncate -s 0 ${config4Out}
44
39
45
- ../../run-cbmc-danger-benchmark.sh ${benchmark} /main.c &
46
- cbmcPid=$!
47
- cegis ${benchmarkArgs} > ${cegisOut} 2> main.cegis.err &
48
- # ../../sleep-echo.sh 10 1>${cegisOut} &
49
- cegisPid=$!
50
- cegis ${benchmarkArgs} --die --cegis-tournament-select > ${cegisHeadStartOut} 2> main.cegis-symex-head-start.err &
51
- # ../../sleep-echo.sh 100 1>${cegisHeadStartOut} &
52
- cegisSymexHeadStartPid=$!
53
- cegis ${benchmarkArgs} --cegis-symex-head-start 2 > ${cegisTournamentOut} 2> main.cegis-tournament-select.err &
54
- # ../../sleep-echo.sh 100 1>${cegisTournamentOut} & # unnecessary
55
- cegisTournamentPid=$!
56
- cegis ${benchmarkArgs} --cegis-symex-head-start 2 --cegis-tournament-select > ${cegisHeadStartTournamentOut} 2> main.cegis-symex-head-start-tournament-select.err & # unnecessary
57
- # ../../sleep-echo.sh 100 1>${cegisHeadStartTournamentOut} &
58
- cegisSymexHeadStartTournamentPid=$!
59
- cegis ${benchmarkArgs} --cegis-symex-head-start 3 --cegis-tournament-select --cegis-parallel-verify > ${config5Out} 2> main.cegis-config5.err &
60
- # ../../sleep-echo.sh 100 1>${cegisHeadStartTournamentOut} & # unnecessary
61
- config5Pid=$!
62
- cegis ${benchmarkArgs} --cegis-symex-head-start 1 > ${config6Out} 2> main.cegis-config6.err &
63
- # ../../sleep-echo.sh 100 1>${cegisHeadStartTournamentOut} & # unnecessary
64
- config6Pid=$!
65
- cegis ${benchmarkArgs} --cegis-symex-head-start 3 --cegis-parallel-verify > ${config7Out} 2> main.cegis-config7.err &
66
- # ../../sleep-echo.sh 100 1>${cegisHeadStartTournamentOut} & # unnecessary
67
- config7Pid=$!
68
- cegis ${benchmarkArgs} --cegis-symex-head-start 1 --cegis-tournament-select > ${config8Out} 2> main.cegis-config8.err &
69
- # ../../sleep-echo.sh 100 1>${cegisHeadStartTournamentOut} &
70
- config8Pid=$!
40
+ cegis ${benchmarkArgs} --cegis-parallel-verify > ${config1Out} 2> main.cegis.err &
41
+ config1Pid=$!
42
+ cegis ${benchmarkArgs} --cegis-symex-head-start 2 > ${config2Out} 2> main.cegis.err &
43
+ config2Pid=$!
44
+ cegis ${benchmarkArgs} --cegis-tournament-select > ${config3Out} 2> main.cegis.err &
45
+ config3Pid=$!
46
+ cegis ${benchmarkArgs} --cegis-tournament-select --cegis-symex-head-start 2 > ${config4Out} 2> main.cegis.err &
47
+ config4Pid=$!
71
48
72
- cegisStopped=0
73
- # while [ ${cegisStopped} -eq 0 ] || [ ${cegisSymexHeadStartStopped} -eq 0 ] || [ ${cegisTournamentStopped} -eq 0 ]; do
74
- while [ ${cegisStopped} -eq 0 ] || [ ${cegisSymexHeadStartStopped} -eq 0 ] || [ ${cegisTournamentStopped} -eq 0 ] || [ ${cegisSymexHeadStartTournamentStopped} -eq 0 ] || [ ${config5Stopped} -eq 0 ] || [ ${config6Stopped} -eq 0 ] || [ ${config7Stopped} -eq 0 ] || [ ${config8Stopped} -eq 0 ] || [ ${cbmcStopped} -eq 0 ]; do
75
- kill -0 ${cegisPid} > /dev/null 2>&1 ; cegisStopped=$?
76
- grep --quiet " ${successValue} " ${cegisOut} ; cegisSuccess=$?
77
- kill -0 ${cegisSymexHeadStartPid} > /dev/null 2>&1 ; cegisSymexHeadStartStopped=$?
78
- grep --quiet " ${successValue} " ${cegisHeadStartOut} ; cegisSymexHeadStartSuccess=$?
79
- kill -0 ${cegisTournamentPid} > /dev/null 2>&1 ; cegisTournamentStopped=$?
80
- grep --quiet " ${successValue} " ${cegisTournamentOut} ; cegisTournamentSuccess=$?
81
- kill -0 ${cegisSymexHeadStartTournamentPid} > /dev/null 2>&1 ; cegisSymexHeadStartTournamentStopped=$?
82
- grep --quiet " ${successValue} " ${cegisHeadStartTournamentOut} ; cegisSymexHeadStartTournamentSuccess=$?
83
- kill -0 ${config5Pid} > /dev/null 2>&1 ; config5Stopped=$?
84
- grep --quiet " ${successValue} " ${config5Out} ; config5Success=$?
85
- kill -0 ${config6Pid} > /dev/null 2>&1 ; config6Stopped=$?
86
- grep --quiet " ${successValue} " ${config6Out} ; config6Success=$?
87
- kill -0 ${config7Pid} > /dev/null 2>&1 ; config7Stopped=$?
88
- grep --quiet " ${successValue} " ${config7Out} ; config7Success=$?
89
- kill -0 ${config8Pid} > /dev/null 2>&1 ; config8Stopped=$?
90
- grep --quiet " ${successValue} " ${config8Out} ; config8Success=$?
91
- kill -0 ${cbmcPid} > /dev/null 2>&1 ; cbmcStopped=$?
92
- grep --quiet " VERIFICATION" ${config8Out} ; cbmcSuccess=$?
49
+ config1Stopped=0
50
+ while [ ${config1Stopped} -eq 0 ] || [ ${config2Stopped} -eq 0 ] || [ ${config3Stopped} -eq 0 ] || [ ${config4Stopped} -eq 0 ]; do
51
+ kill -0 ${config1Pid} > /dev/null 2>&1 ; config1Stopped=$?
52
+ grep --quiet " ${successValue} " ${config1Out} ; config1Success=$?
53
+ kill -0 ${config2Pid} > /dev/null 2>&1 ; config2Stopped=$?
54
+ grep --quiet " ${successValue} " ${config2Out} ; config2Success=$?
55
+ kill -0 ${config3Pid} > /dev/null 2>&1 ; config3Stopped=$?
56
+ grep --quiet " ${successValue} " ${config3Out} ; config3Success=$?
57
+ kill -0 ${config4Pid} > /dev/null 2>&1 ; config4Stopped=$?
58
+ grep --quiet " ${successValue} " ${config4Out} ; config4Success=$?
93
59
94
- # if [ ${cegisSuccess} -eq 0 ] || [ ${cegisSymexHeadStartSuccess} -eq 0 ] || [ ${cegisTournamentSuccess} -eq 0 ]; then
95
- if [ ${cegisSuccess} -eq 0 ] || [ ${cegisSymexHeadStartSuccess} -eq 0 ] || [ ${cegisTournamentSuccess} -eq 0 ] || [ ${cegisSymexHeadStartTournamentSuccess} -eq 0 ] || [ ${config5Success} -eq 0 ] || [ ${config6Success} -eq 0 ] || [ ${config7Success} -eq 0 ] || [ ${config8Success} -eq 0 ] || [ ${cbmcSuccess} -eq 0 ]; then
96
- # while [ ${cegisStopped} -eq 0 ] || [ ${cegisSymexHeadStartStopped} -eq 0 ] || [ ${cegisTournamentStopped} -eq 0 ]; do
97
- while [ ${cegisStopped} -eq 0 ] || [ ${cegisSymexHeadStartStopped} -eq 0 ] || [ ${cegisTournamentStopped} -eq 0 ] || [ ${cegisSymexHeadStartTournamentStopped} -eq 0 ] || [ ${config5Stopped} -eq 0 ] || [ ${config6Stopped} -eq 0 ] || [ ${config7Stopped} -eq 0 ] || [ ${config8Stopped} -eq 0 ] || [ ${cbmcStopped} -eq 0 ]; do
60
+ if [ ${config1Success} -eq 0 ] || [ ${config2Success} -eq 0 ] || [ ${config3Success} -eq 0 ] || [ ${config4Success} -eq 0 ]; then
61
+ while [ ${config1Stopped} -eq 0 ] || [ ${config2Stopped} -eq 0 ] || [ ${config3Stopped} -eq 0 ] || [ ${config4Stopped} -eq 0 ]; do
98
62
killall -9 cegis > /dev/null 2>&1
99
- killall -9 cbmc > /dev/null 2>&1
100
- killall timeout > /dev/null 2>&1
101
- kill -0 ${cegisPid} > /dev/null 2>&1 ; cegisStopped=$?
102
- kill -0 ${cegisSymexHeadStartPid} > /dev/null 2>&1 ; cegisSymexHeadStartStopped=$?
103
- kill -0 ${cegisTournamentPid} > /dev/null 2>&1 ; cegisTournamentStopped=$?
104
- kill -0 ${cegisSymexHeadStartTournamentPid} > /dev/null 2>&1 ; cegisSymexHeadStartTournamentStopped=$?
105
- kill -0 ${config5Pid} > /dev/null 2>&1 ; config5Stopped=$?
106
- kill -0 ${config6Pid} > /dev/null 2>&1 ; config6Stopped=$?
107
- kill -0 ${config7Pid} > /dev/null 2>&1 ; config7Stopped=$?
108
- kill -0 ${config8Pid} > /dev/null 2>&1 ; config8Stopped=$?
109
- kill -0 ${cbmcPid} > /dev/null 2>&1 ; cbmcStopped=$?
63
+ kill -0 ${config1Pid} > /dev/null 2>&1 ; config1Stopped=$?
64
+ kill -0 ${config2Pid} > /dev/null 2>&1 ; config2Stopped=$?
65
+ kill -0 ${config3Pid} > /dev/null 2>&1 ; config3Stopped=$?
66
+ kill -0 ${config4Pid} > /dev/null 2>&1 ; config4Stopped=$?
110
67
sleep 10
111
68
done
112
69
fi
113
70
sleep 10
114
71
done
115
72
116
- if [ ${cegisSuccess} -eq 0 ]; then
117
- echo -n ' base' >> " ${resultFile} "
118
- outFile=${cegisOut}
119
- elif [ ${cegisSymexHeadStartSuccess} -eq 0 ]; then
120
- echo -n ' symex-head-start' >> " ${resultFile} "
121
- outFile=${cegisHeadStartOut}
122
- elif [ ${cegisTournamentSuccess} -eq 0 ]; then
123
- echo -n ' tournament' >> " ${resultFile} "
124
- outFile=${cegisTournamentOut}
125
- elif [ ${cegisSymexHeadStartTournamentSuccess} -eq 0 ]; then
126
- echo -n ' tournament-symex-head-start' >> " ${resultFile} "
127
- outFile=${cegisHeadStartTournamentOut}
128
- elif [ ${config5Success} -eq 0 ]; then
129
- echo -n ' config5' >> " ${resultFile} "
130
- outFile=${config5Out}
131
- elif [ ${config6Success} -eq 0 ]; then
132
- echo -n ' config6' >> " ${resultFile} "
133
- outFile=${config6Out}
134
- elif [ ${config7Success} -eq 0 ]; then
135
- echo -n ' config7' >> " ${resultFile} "
136
- outFile=${config7Out}
137
- elif [ ${config8Success} -eq 0 ]; then
138
- echo -n ' config8' >> " ${resultFile} "
139
- outFile=${config8Out}
140
- elif [ ${cbmcSuccess} -eq 0 ]; then
141
- echo -n ' cbmc' >> " ${resultFile} "
142
- outFile=' none'
73
+ if [ ${config1Success} -eq 0 ]; then
74
+ echo -n ' config1' >> " ${resultFile} "
75
+ outFile=${config1Out}
76
+ elif [ ${config2Success} -eq 0 ]; then
77
+ echo -n ' config2' >> " ${resultFile} "
78
+ outFile=${config2Out}
79
+ elif [ ${config3Success} -eq 0 ]; then
80
+ echo -n ' config3' >> " ${resultFile} "
81
+ outFile=${config3Out}
82
+ elif [ ${config4Success} -eq 0 ]; then
83
+ echo -n ' config4' >> " ${resultFile} "
84
+ outFile=${config4Out}
143
85
else
144
86
echo -n ' none' >> " ${resultFile} "
145
87
outFile=' none'
0 commit comments