-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
224 lines (167 loc) · 6.24 KB
/
Makefile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
python=python3
clean: ; rm -rf *.reduce.log *.fuzz.log results fuzzing
clobber: clean;
-$(MAKE) box-remove
-rm -rf artifact artifact.tar.gz
-rm -rf .db
results:; mkdir -p results
find_bugs=07b941b1 93623752 c8491c11 dbcb10e9
grep_bugs=3c3bdace 54d55bba 9c45c193
closure_bugs=2808 2842 2937 3178 3379 1978
clojure_bugs=2092 2345 2450 2473 2518 2521
lua_bugs=5_3_5__4
rhino_bugs=385 386
find_results_src=$(addsuffix .log,$(addprefix results/reduce_find_,$(find_bugs)))
grep_results_src=$(addsuffix .log,$(addprefix results/reduce_grep_,$(grep_bugs)))
lua_results_src=$(addsuffix .log,$(addprefix results/reduce_lua_,$(lua_bugs)))
rhino_results_src=$(addsuffix .log,$(addprefix results/reduce_rhino_,$(rhino_bugs)))
clojure_results_src=$(addsuffix .log,$(addprefix results/reduce_clojure_,$(clojure_bugs)))
closure_results_src=$(addsuffix .log,$(addprefix results/reduce_closure_,$(closure_bugs)))
fuzz_find_results_src=$(addsuffix .log,$(addprefix results/fuzz_find_,$(find_bugs)))
fuzz_grep_results_src=$(addsuffix .log,$(addprefix results/fuzz_grep_,$(grep_bugs)))
fuzz_lua_results_src=$(addsuffix .log,$(addprefix results/fuzz_lua_,$(lua_bugs)))
fuzz_rhino_results_src=$(addsuffix .log,$(addprefix results/fuzz_rhino_,$(rhino_bugs)))
fuzz_closure_results_src=$(addsuffix .log,$(addprefix results/fuzz_closure_,$(closure_bugs)))
fuzz_clojure_results_src=$(addsuffix .log,$(addprefix results/fuzz_clojure_,$(clojure_bugs)))
start_%:; @echo done
stop_%:; @echo done
stop_find: $(addprefix stop_,$(find_bugs))
@echo done.
stop_grep: $(addprefix stop_,$(grep_bugs))
@echo done.
$(addprefix start_,$(grep_bugs)):
sudo docker stop $(subst start_,,$@)
sudo docker start $(subst start_,,$@)
$(addprefix stop_,$(grep_bugs)):
sudo docker stop $(subst stop_,,$@)
$(addprefix start_,$(find_bugs)):
sudo docker stop $(subst start_,,$@)
sudo docker start $(subst start_,,$@)
$(addprefix stop_,$(find_bugs)):
sudo docker stop $(subst stop_,,$@)
unbuffer= #unbuffer -p
results/reduce_%.log: src/%.py | results
@- $(MAKE) start_$(subst find_,,$*)
@- $(MAKE) start_$(subst grep_,,$*)
time $(python) $< 2>&1 | $(unbuffer) tee $@_
@- $(MAKE) stop_$(subst find_,,$*)
@- $(MAKE) stop_$(subst grep_,,$*)
mv $@_ $@
results/fuzz_%.log: src/fuzz_%.py results/reduce_%.log
@- $(MAKE) start_$(subst find_,,$*)
@- $(MAKE) start_$(subst grep_,,$*)
time $(python) $< 2>&1 | $(unbuffer) tee $@_
@- $(MAKE) stop_$(subst find_,,$*)
@- $(MAKE) stop_$(subst grep_,,$*)
mv $@_ $@
reduce_find: $(find_results_src); @echo done
reduce_grep: $(grep_results_src); @echo done
reduce_lua: $(lua_results_src); @echo done
reduce_rhino: $(rhino_results_src); @echo done
reduce_clojure: $(clojure_results_src); @echo done
reduce_closure: $(closure_results_src); @echo done
fuzz_find: $(fuzz_find_results_src); @echo done
fuzz_grep: $(fuzz_grep_results_src); @echo done
fuzz_lua: $(fuzz_lua_results_src); @echo done
fuzz_rhino: $(fuzz_rhino_results_src); @echo done
fuzz_clojure: $(fuzz_clojure_results_src); @echo done
fuzz_closure: $(fuzz_closure_results_src); @echo done
all_find: fuzz_find
tar -cf find.tar results .db
@echo find done
all_grep: fuzz_grep
tar -cf grep.tar results .db
@echo grep done
all_lua: fuzz_lua
tar -cf lua.tar results .db
@echo lua done
all_rhino: fuzz_rhino
tar -cf rhino.tar results .db
@echo rhino done
all_clojure: fuzz_clojure
tar -cf clojure.tar results .db
@echo clojure done
all_closure: fuzz_closure
tar -cf closure.tar results .db
@echo closure done
all: all_lua all_rhino all_clojure all_closure all_find all_grep
@echo done
dbgbench-init: .dbgbench init-find init-grep
@echo done
.dbgbench:
git clone https://github.com/vrthra-forks/dbgbench.github.io.git
touch $@
dbgbench-clobber:
-$(MAKE) rm-find
-$(MAKE) rm-grep
rm -rf dbgbench.github.io .dbgbench
init-find: .dbgbench;
for i in $(find_bugs); do \
$(MAKE) -C dbgbench.github.io/docker initfind-$$i; \
sudo docker stop $$i; \
done
init-grep: .dbgbench;
for i in $(grep_bugs); do \
$(MAKE) -C dbgbench.github.io/docker initgrep-$$i; \
sudo docker stop $$i; \
done
rm-find:; $(MAKE) -C dbgbench.github.io/docker rm-find
rm-grep:; $(MAKE) -C dbgbench.github.io/docker rm-grep
prune-find:; sudo docker system prune --filter ancestor=ddset/find || echo
prune-grep:; sudo docker system prune --filter ancestor=ddset/grep || echo
ls-find:; @sudo docker ps -a --filter ancestor=ddset/find --format 'table {{.Image}} {{.ID}} {{.Names}} {{.Status}}'
ls-grep:; @sudo docker ps -a --filter ancestor=ddset/grep --format 'table {{.Image}} {{.ID}} {{.Names}} {{.Status}}'
artifact.tar.gz: Vagrantfile
rm -rf artifact && mkdir -p artifact/ddset
cp README.md artifact/README.txt
cp -r README.md lang src dbgbench.github.io .dbgbench Makefile Vagrantfile artifact/ddset
cp -r Vagrantfile artifact/
tar -cf artifact1.tar artifact
gzip artifact1.tar
mv artifact1.tar.gz artifact.tar.gz
# PACKAGING
box-create: ddset.box
ddset.box: artifact.tar.gz
cd artifact && vagrant up
cd artifact && vagrant ssh -c 'cd /vagrant; tar -cpf ~/ddset.tar ddset ; cd ~/; tar -xpf ~/ddset.tar; rm -f ~/ddset.tar'
cd artifact && vagrant ssh -c 'cd ~/ddset && make dbgbench-init'
cd artifact && vagrant package --output ../ddset1.box --vagrantfile ../Vagrantfile.new
mv ddset1.box ddset.box
box-hash:
md5sum ddset.box
box-add: ddset.box
-vagrant destroy $$(vagrant global-status | grep ddset | sed -e 's# .*##g')
rm -rf vtest && mkdir -p vtest && cp ddset.box vtest
cd vtest && vagrant box add ddset ./ddset.box
cd vtest && vagrant init ddset
cd vtest && vagrant up
box-status:
vagrant global-status | grep ddset
vagrant box list | grep ddset
box-remove:
-vagrant destroy $$(vagrant global-status | grep ddset | sed -e 's# .*##g')
vagrant box remove ddset
show-ports:
sudo netstat -ln --program | grep 8888
box-connect1:
cd artifact; vagrant ssh
box-connect2:
cd vtest; vagrant ssh
REMOTE=ddset-issta2020:
REMOTE=anonymous-issta2020:
rupload:
rm -rf ddset.issta2020 && mkdir -p ddset.issta2020
cp ddset.box ddset.issta2020
rclone --contimeout=24h -v copy ddset.issta2020 $(REMOTE)issta2020/
rls:
rclone ls $(REMOTE)
rrm:
rclone delete $(REMOTE)issta2020/ddset.box
rlink:
rclone link $(REMOTE)issta2020/
VM=
vm-list:
VBoxManage list vms
vm-remove:
-VBoxManage startvm $(VM) --type emergencystop
VBoxManage unregistervm $(VM) -delete