-
Notifications
You must be signed in to change notification settings - Fork 60
/
Makefile
271 lines (194 loc) · 8.7 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# we disable it, as we only enable it for the eqwalize target
BASE_DIR = $(shell pwd)
CONCURRENCY ?= 4
DEP_DIR ?= "deps"
EBIN_DIR ?= "ebin"
ERLANG_BIN = $(shell dirname $(shell which erl))
LATENCY ?= 0
MAKE = make
PACKAGE ?= partisan
PROJECT ?= $(shell basename `find src -name "*.app.src"` .app.src)
REBAR ?= rebar3
REVISION ?= $(shell git rev-parse --short HEAD)
SIZE ?= 1024
VERSION ?= $(shell git describe --tags)
CODESPELL = $(shell which codespell)
SPELLCHECK = $(CODESPELL) -S _build -S doc -S .git -L applys,nd,accout,mattern,pres,fo
SPELLFIX = $(SPELLCHECK) -i 3 -w
PARTISAN_EQWALIZER = 0
OTPVSN = $(shell erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell)
.PHONY: compile-no-deps alt-test core-test otp-test test docs xref dialyzer-run dialyzer-quick dialyzer eqwalizer eqwalize-all\
cleanplt upload-docs rel deps test plots spellcheck spellfix certs node1 node2 node3 node checkssl
all: compile
##
## Compilation targets
##
certs:
cd config && ./make_certs
compile-no-deps:
${REBAR} compile skip_deps=true
docs:
${REBAR} ex_doc skip_deps=true
xref: compile
${REBAR} xref skip_deps=true
dialyzer: compile
${REBAR} dialyzer
# This is super slow as we are invoking equalizer for each source file as
# opposed to once. We do this becuase we want to ignore modules in the otp_src
# directory but at the moment Eqwalizer does not allow that option
eqwalizer: src/*.erl
ifeq ($(shell expr $(OTPVSN) \> 24),1)
export PARTISAN_EQWALIZER=1 && for file in $(shell ls $^ | sed 's|.*/\(.*\)\.erl|\1|'); do elp eqwalize $${file}; done
else
$(info OTPVSN is not higher than 24)
$(eval override mytarget=echo "skipping eqwalizer target. Eqwalizer tool requires OTP25 or higher")
endif
eqwalize-all:
ifeq ($(shell expr $(OTPVSN) \> 24),1)
PARTISAN_EQWALIZER=1 elp eqwalize-all
else
$(info OTPVSN is not higher than 24)
$(eval override mytarget=echo "skipping eqwalizer target. Eqwalizer tool requires OTP25 or higher")
endif
compile:
$(REBAR) compile
clean: packageclean
$(REBAR) clean
packageclean:
rm -fr *.deb
rm -fr *.tar.gz
##
## Test targets
##
proper:
pkill -9 beam.smp; rm -rf priv/lager; ./rebar3 proper -m prop_partisan -p prop_sequential --noshrink -n 10
perf:
pkill -9 beam.smp; pkill -9 epmd; SIZE=${SIZE} LATENCY=${LATENCY} CONCURRENCY=${CONCURRENCY} ${REBAR} ct --readable=false -v --suite=partisan_SUITE --case=performance_test --group=with_disterl
pkill -9 beam.smp; pkill -9 epmd; SIZE=${SIZE} LATENCY=${LATENCY} CONCURRENCY=${CONCURRENCY} ${REBAR} ct --readable=false -v --suite=partisan_SUITE --case=performance_test --group=default
pkill -9 beam.smp; pkill -9 epmd; SIZE=${SIZE} LATENCY=${LATENCY} CONCURRENCY=${CONCURRENCY} PARALLELISM=${CONCURRENCY} ${REBAR} ct --readable=false -v --suite=partisan_SUITE --case=performance_test --group=with_parallelism
kill:
pkill -9 beam.smp; pkill -9 epmd; exit 0
check: kill xref dialyzer eqwalizer
spellcheck:
$(if $(CODESPELL), $(SPELLCHECK), $(error "Aborting, command codespell not found in PATH"))
spellfix:
$(if $(CODESPELL), $(SPELLFIX), $(error "Aborting, command codespell not found in PATH"))
test: eunit core-test otp-test cover
core-test: setup-tls
ifeq ($(shell expr $(OTPVSN) \> 24),1)
$(info OTPVSN is higher than 24)
$(info Skipping core-test target. CT Suite currently requires OTP24)
else
${REBAR} as test ct -v --readable=false --suite=partisan_SUITE
endif
otp-test: setup-tls
ifeq ($(shell expr $(OTPVSN) \> 24),1)
$(info OTPVSN is higher than 24)
$(eval override mytarget=echo "skipping al-test target. CT Suite currently requires OTP24")
else
${REBAR} as test ct --suite=partisan_gen_server_SUITE,partisan_gen_event_SUITE,partisan_gen_statem_SUITE
endif
alt-test: setup-tls
ifeq ($(shell expr $(OTPVSN) \> 24),1)
$(info OTPVSN is higher than 24)
$(eval override mytarget=echo "skipping alt-test target. CT Suite currently requires OTP24")
else
mkdir -p test/partisan_alt_SUITE_data/
openssl rand -out test/partisan_alt_SUITE_data/RAND 4096
${REBAR} as test ct -v --readable=false --suite=partisan_alt_SUITE
endif
setup-tls:
mkdir -p test/partisan_SUITE_data/
openssl rand -out test/partisan_SUITE_data/RAND 4096
lint:
${REBAR} as lint lint
eunit:
${REBAR} as test eunit
cover:
${REBAR} cover
shell:
${REBAR} shell --apps partisan
tail-logs:
tail ---disable-inotify -F priv/lager/*/log/*.log
unsorted-logs:
cat priv/lager/*/log/*.log
logs:
cat priv/lager/*/log/*.log | sort -k2M # -k3n -k4
##
## Release targets
##
node1:
${REBAR} as node1 release
ERL_DIST_PORT=37781 _build/node1/rel/partisan/bin/partisan console
node2:
${REBAR} as node2 release
ERL_DIST_PORT=37782 _build/node2/rel/partisan/bin/partisan console
node3:
${REBAR} as node3 release
ERL_DIST_PORT=37783 _build/node3/rel/partisan/bin/partisan console
checkssl:
openssl s_client -connect localhost:10100 \
-cert config/_ssl/client/cert.pem \
-key config/_ssl/client/keycert.pem \
-CAfile config/_ssl/client/cacerts.pem
rel:
${REBAR} as test release
stage:
${REBAR} as test release -d
DIALYZER_APPS = kernel stdlib erts sasl eunit syntax_tools compiler crypto
##
## Container targets
##
containerize-deps:
docker build -f partisan-base.Dockerfile -t cmeiklejohn/partisan-base .
containerize-tests: containerize-deps
docker build --no-cache -f partisan-test-suite.Dockerfile -t cmeiklejohn/partisan-test-suite .
containerize: containerize-deps
docker build --no-cache -f Dockerfile -t cmeiklejohn/partisan .
compose: containerize
docker-compose down; docker-compose rm; docker-compose up
##
## CI targets
##
verify-lampson-2pc: kill bin-perms compile
make lampson-2pc | grep "Passed: 7, Failed: 1"
verify-bernstein-ctp: kill bin-perms compile
make bernstein-ctp | grep "Passed: 11, Failed: 1"
verify-skeen-3pc: kill bin-perms compile
make skeen-3pc | grep "Passed: 25, Failed: 1"
##
## Testing targets
##
make bin-perms:
chmod 755 bin/*.sh
chmod 755 bin/*.escript
demers-anti-entropy: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=demers_anti_entropy SUBLIST=0 bin/check-model.sh
demers-rumor-mongering: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=demers_rumor_mongering SUBLIST=0 bin/check-model.sh
demers-direct-mail-acked: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=demers_direct_mail_acked SUBLIST=0 bin/check-model.sh
demers-direct-mail: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=demers_direct_mail SUBLIST=0 bin/check-model.sh
lampson-2pc: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=lampson_2pc SUBLIST=0 bin/check-model.sh
bernstein-ctp: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=bernstein_ctp SUBLIST=0 bin/check-model.sh
skeen-3pc: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=skeen_3pc SUBLIST=0 bin/check-model.sh
lampson-2pc-noise: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_reliable_broadcast EXIT_ON_COUNTEREXAMPLE=true NOISE=true RECURSIVE=false PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=lampson_2pc SUBLIST=0 bin/check-model.sh
paxoid: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_paxoid RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=paxoid SUBLIST=0 bin/check-paxoid.sh
lashup: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_lashup RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=lashup SUBLIST=0 bin/check-lashup.sh
zraft: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_zraft RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=zraft SUBLIST=0 bin/check-zraft.sh
hbbft: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_hbbft RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=hbbft SUBLIST=0 bin/check-hbbft.sh
alsberg-day: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_primary_backup RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=alsberg_day SUBLIST=0 bin/filibuster.sh
alsberg-day-acked: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_primary_backup RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=alsberg_day_acked SUBLIST=0 bin/filibuster.sh
alsberg-day-acked-membership: kill bin-perms compile
SYSTEM_MODEL=prop_partisan_primary_backup RECURSIVE=true PRELOAD_SCHEDULES=false IMPLEMENTATION_MODULE=alsberg_day_acked_membership SUBLIST=0 bin/filibuster.sh