-
Notifications
You must be signed in to change notification settings - Fork 198
Expand file tree
/
Copy pathMakefile
More file actions
195 lines (170 loc) · 9.63 KB
/
Makefile
File metadata and controls
195 lines (170 loc) · 9.63 KB
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
all: test defensive_test send_delay_test check_all
check_all: lint fmt doc unused_dep typos
compile:
cargo test --lib
cargo test --test '*'
cargo test --features single-threaded --lib
basic_check:
cargo fmt
cargo clippy --no-deps --all-targets --fix --allow-dirty --allow-staged
cargo test --lib
cargo test --test '*'
# cargo test --features single-threaded --lib
cargo clippy --no-deps --all-targets -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --document-private-items --all --no-deps
# test result in different output on CI are ignored and only run locally
cargo test -p openraft-macros -- --ignored
defensive_test:
OPENRAFT_STORE_DEFENSIVE=on cargo test
send_delay_test:
OPENRAFT_NETWORK_SEND_DELAY=30 cargo test
test:
cargo test
cargo test --features bt
cargo test --features serde
# only crate `tests` has single-term-leader feature
cargo test --features single-term-leader -p tests
# multiraft crate tests
cargo test --manifest-path multiraft/Cargo.toml
$(MAKE) test-examples
check-parallel:
./scripts/check-parallel.sh
test-examples:
cargo test --manifest-path examples/log-mem/Cargo.toml
cargo test --manifest-path examples/raft-kv-memstore/Cargo.toml
cargo test --manifest-path examples/raft-kv-memstore-grpc/Cargo.toml
cargo test --manifest-path examples/raft-kv-memstore-network-v2/Cargo.toml
cargo test --manifest-path examples/raft-kv-memstore-opendal-snapshot-data/Cargo.toml
cargo test --manifest-path examples/raft-kv-memstore-single-threaded/Cargo.toml
cargo test --manifest-path examples/raft-kv-rocksdb/Cargo.toml
cargo test --manifest-path examples/rocksstore/Cargo.toml
cargo test --manifest-path examples/multi-raft-kv/Cargo.toml
bench:
cargo bench --features bench
# Set TOKIO_CONSOLE=1 to enable tokio-console support
# Set FLAMEGRAPH=1 to enable flamegraph profiling
# Example: TOKIO_CONSOLE=1 make bench_cluster_of_3
comma := ,
BENCH_FEATURES := $(if $(TOKIO_CONSOLE),tokio-console,)$(if $(FLAMEGRAPH),$(if $(TOKIO_CONSOLE),$(comma))flamegraph,)
BENCH_FEATURES_FLAG := $(if $(BENCH_FEATURES),--features $(BENCH_FEATURES),)
BENCH_RUSTFLAGS := $(if $(TOKIO_CONSOLE),RUSTFLAGS="--cfg tokio_unstable",)
bench_cluster_of_1:
$(BENCH_RUSTFLAGS) cargo run --manifest-path benchmarks/minimal/Cargo.toml --release --bin bench $(BENCH_FEATURES_FLAG) -- -m 1
bench_cluster_of_3:
$(BENCH_RUSTFLAGS) cargo run --manifest-path benchmarks/minimal/Cargo.toml --release --bin bench $(BENCH_FEATURES_FLAG) -- -m 3
bench_cluster_of_5:
$(BENCH_RUSTFLAGS) cargo run --manifest-path benchmarks/minimal/Cargo.toml --release --bin bench $(BENCH_FEATURES_FLAG) -- -m 5
fmt:
cargo fmt
fix:
cargo fix --allow-staged
doc:
make -C openraft/src/docs/faq
make -C openraft/src/docs/feature_flags
RUSTDOCFLAGS="-D warnings" cargo doc --document-private-items --all --no-deps
check_missing_doc:
# Warn about missing doc for public API
RUSTDOCFLAGS="-W missing_docs" cargo doc --all --no-deps
guide:
mdbook build
@echo "doc is built in:"
@echo "./guide/book/index.html"
lint:
cargo fmt
cargo fmt --manifest-path multiraft/Cargo.toml
cargo fmt --manifest-path rt-compio/Cargo.toml
cargo fmt --manifest-path rt-monoio/Cargo.toml
cargo fmt --manifest-path rt-tokio/Cargo.toml
cargo fmt --manifest-path examples/log-mem/Cargo.toml
cargo fmt --manifest-path examples/sm-mem/Cargo.toml
cargo fmt --manifest-path examples/rocksstore/Cargo.toml
cargo fmt --manifest-path examples/raft-kv-memstore-grpc/Cargo.toml
cargo fmt --manifest-path examples/raft-kv-memstore-network-v2/Cargo.toml
cargo fmt --manifest-path examples/raft-kv-memstore-opendal-snapshot-data/Cargo.toml
cargo fmt --manifest-path examples/raft-kv-memstore-single-threaded/Cargo.toml
cargo fmt --manifest-path examples/raft-kv-memstore/Cargo.toml
cargo fmt --manifest-path examples/raft-kv-rocksdb/Cargo.toml
cargo fmt --manifest-path examples/multi-raft-kv/Cargo.toml
cargo clippy --no-deps --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path multiraft/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path rt-compio/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path rt-monoio/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path rt-tokio/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/log-mem/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/sm-mem/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/rocksstore/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/raft-kv-memstore-grpc/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/raft-kv-memstore-network-v2/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/raft-kv-memstore-opendal-snapshot-data/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/raft-kv-memstore-single-threaded/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/raft-kv-memstore/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/raft-kv-rocksdb/Cargo.toml --all-targets -- -D warnings
cargo clippy --no-deps --manifest-path examples/multi-raft-kv/Cargo.toml --all-targets -- -D warnings
# Bug: clippy --all-targets reports false warning about unused dep in
# `[dev-dependencies]`:
# https://github.com/rust-lang/rust/issues/72686#issuecomment-635539688
# Thus we only check unused deps for lib
RUSTFLAGS=-Wunused-crate-dependencies cargo clippy --no-deps --lib -- -D warnings
unused_dep:
cargo machete
cargo machete examples/raft-kv-memstore
cargo machete examples/raft-kv-rocksdb
cargo machete examples/raft-kv-memstore-grpc
cargo machete examples/raft-kv-memstore-single-threaded
cargo machete examples/raft-kv-memstore-opendal-snapshot-data
cargo machete examples/raft-kv-memstore-network-v2
cargo machete examples/multi-raft-kv
cargo machete examples/rocksstore
cargo machete multiraft
cargo machete rt-compio
cargo machete rt-monoio
cargo machete rt-tokio
typos:
# cargo install typos-cli
typos --write-changes openraft/ tests/ stores/memstore/ stores/memstore-custom-node-id/ stores/rocksstore examples/raft-kv-memstore/ examples/raft-kv-rocksdb/
#typos --write-changes --exclude change-log/ --exclude change-log.md --exclude derived-from-async-raft.md
# typos
check:
RUSTFLAGS="-D warnings" cargo check
RUSTFLAGS="-D warnings" cargo check --manifest-path multiraft/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path rt-compio/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path rt-monoio/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path rt-tokio/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path metrics-otel/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path benchmarks/minimal/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/client-http/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/network-v1-http/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/log-mem/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/sm-mem/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/rocksstore/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/types-kv/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/raft-kv-memstore-grpc/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/raft-kv-memstore-network-v2/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/raft-kv-memstore-opendal-snapshot-data/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/raft-kv-memstore-single-threaded/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/raft-kv-memstore/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/raft-kv-rocksdb/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/rocksstore/Cargo.toml
RUSTFLAGS="-D warnings" cargo check --manifest-path examples/multi-raft-kv/Cargo.toml
clean:
cargo clean
cargo clean --manifest-path multiraft/Cargo.toml
cargo clean --manifest-path rt-compio/Cargo.toml
cargo clean --manifest-path rt-monoio/Cargo.toml
cargo clean --manifest-path rt-tokio/Cargo.toml
cargo clean --manifest-path metrics-otel/Cargo.toml
cargo clean --manifest-path benchmarks/minimal/Cargo.toml
cargo clean --manifest-path examples/client-http/Cargo.toml
cargo clean --manifest-path examples/network-v1-http/Cargo.toml
cargo clean --manifest-path examples/log-mem/Cargo.toml
cargo clean --manifest-path examples/sm-mem/Cargo.toml
cargo clean --manifest-path examples/rocksstore/Cargo.toml
cargo clean --manifest-path examples/raft-kv-memstore-grpc/Cargo.toml
cargo clean --manifest-path examples/raft-kv-memstore-network-v2/Cargo.toml
cargo clean --manifest-path examples/raft-kv-memstore-opendal-snapshot-data/Cargo.toml
cargo clean --manifest-path examples/raft-kv-memstore-single-threaded/Cargo.toml
cargo clean --manifest-path examples/raft-kv-memstore/Cargo.toml
cargo clean --manifest-path examples/raft-kv-rocksdb/Cargo.toml
cargo clean --manifest-path examples/rocksstore/Cargo.toml
cargo clean --manifest-path examples/multi-raft-kv/Cargo.toml
.PHONY: test fmt lint clean doc guide