-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
143 lines (108 loc) · 3.2 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
# =============================================================================
# verify that the programs we need to run are installed on this system
# =============================================================================
ERL = $(shell which erl)
SED = $(shell which sed)
CT_RUN = $(shell which ct_run)
RM = $(shell which rm)
MKDIR = $(shell which mkdir)
ELIXIR = $(shell which elixir)
SLEEP = $(shell which sleep)
TESTNET=./bin/testnet.sh
LOG_DIR=_build/test/logs
ifeq ($(ERL),)
$(error "Erlang not available on this system")
endif
# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR = $(CURDIR)/rebar3
endif
all:
@echo What you wanna to make?
@echo make build - compile
@echo make run1 - run node1
@echo make run2 - run node2
@echo make run3 - rin node3
build:
$(REBAR) compile
compile: build
deps:
$(REBAR) get-deps
rebar:
ifeq ($(REBAR),)
$(error "rebar3 isn't available on this system")
endif
elixir:
ifeq ($(ELIXIR),)
$(error "elixir isn't available on this system")
endif
run1:
erl -config app1.config -sname rocksnode1 -pa _build/default/lib/*/ebin +SDcpu 2:2: -s lager -s sync -s tpnode
run2:
erl -config app2.config -sname rocksnode2 -pa _build/default/lib/*/ebin +SDcpu 2:2: -s lager -s sync -s tpnode
run3:
erl -config app3.config -sname rocksnode3 -pa _build/default/lib/*/ebin +SDcpu 2:2: -s lager -s sync -s tpnode
runtestnet:
$(TESTNET) start
lint: rebar
$(REBAR) elvis
dialyzer: rebar
$(REBAR) dialyzer
xref: rebar
$(REBAR) xref skip_deps=true
tests: rebar
$(TESTNET) start
# $(REBAR) as test ct skip_deps=true --cover --verbose
# $(REBAR) as test ct --cover --verbose
# mkdir -p _build/test/logs
# cd _build/test/logs
# $(REBAR) as test compile
# ct_run -logdir _build/test/logs --cover true --verbose -pa `$(REBAR) path`
@REBAR_PROFILE=test $(REBAR) do ct --verbose
# @REBAR_PROFILE=test $(REBAR) do ct -c, cover --verbose
# @REBAR_PROFILE=test $(REBAR) do ct, cover --verbose
# $(REBAR) as test cover --verbose
# $(TESTNET) stop
coffebreak:
@$(SLEEP) 5
synctest: elixir
@$(ELIXIR) -pa '_build/test/lib/*/ebin/' --sname tester test/sync_test.exs
cleantest:
$(RM) -rf _build/test
@$(MKDIR) -p _build/test/cover
@$(MKDIR) -p $(LOG_DIR)
buildtest: rebar
@REBAR_PROFILE=test $(REBAR) do compile
prepare_cover: sedcheck
@$(SED) -re "s/@[^']+/@`hostname -s`/gi" <test/tpnode.coverspec.tpl >test/tpnode.coverspec
eunit: rebar prepare_cover
@REBAR_PROFILE=test $(REBAR) do eunit --cover
cover: ctruncheck cleantest buildtest rebar prepare_cover eunit
@$(TESTNET) start
@$(CT_RUN) -pa _build/test/lib/*/ebin \
-cover test/tpnode.coverspec \
-logdir $(LOG_DIR) \
-cover_stop false \
-suite basic_SUITE -suite evm_SUITE \
-noshell
@$(TESTNET) stop
nocover: ctruncheck cleantest buildtest rebar
@$(TESTNET) start
@$(CT_RUN) -pa _build/test/lib/*/ebin \
-logdir $(LOG_DIR) \
-cover_stop false \
-suite basic_SUITE -suite evm_SUITE \
-noshell
@$(TESTNET) stop
reset: cleantest
@$(TESTNET) reset
sedcheck:
ifeq ($(SED),)
$(error "'sed' not available on this system")
endif
ctruncheck:
ifeq ($(CT_RUN),)
$(error "'ct_run' not available on this system")
endif
node1shell: rebar
$(REBAR) as node1 shell