-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (56 loc) · 2.56 KB
/
Copy pathMakefile
File metadata and controls
71 lines (56 loc) · 2.56 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
BUILD_DIR ?= build
CMAKE ?= cmake
JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
.PHONY: configure build test chaos-smoke chaos-full chaos-budget bench bench-scaling bench-regress clean format format-check tsan-build tsan-stress
configure:
$(CMAKE) -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=RelWithDebInfo
build: configure
$(CMAKE) --build $(BUILD_DIR) -j $(JOBS)
test: build
cd $(BUILD_DIR) && ctest --output-on-failure -E '^chaos_(smoke|full)$$'
chaos-smoke: build
cd $(BUILD_DIR) && ./chaos_test --scenarios=20 --seed=1
chaos-full: build
cd $(BUILD_DIR) && ./chaos_test --scenarios=500 --seed=1 --json=$(CURDIR)/bench/results/chaos_local.json
# Same scope as chaos-full but stops after BUDGET seconds of wall clock.
# Mirrors what CI runs.
chaos-budget: build
cd $(BUILD_DIR) && ./chaos_test --scenarios=500 --seed=1 \
--budget-seconds=$${BUDGET:-540} \
--json=$(CURDIR)/bench/results/chaos_local.json
tsan-build:
$(CMAKE) -S . -B build-tsan -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DRAFTKV_TSAN=ON -DRAFTKV_WITH_GRPC=OFF
$(CMAKE) --build build-tsan -j $(JOBS)
tsan-stress: tsan-build
cd build-tsan && for t in log_test state_machine_test persister_test \
election_test replication_test log_invariants_test \
leader_election_integration replication_integration \
snapshot_integration client_ops_integration; do \
echo "=== TSan stress: $$t ==="; \
./$$t --gtest_repeat=3 --gtest_break_on_failure || exit 1; \
done
bench: build
cd $(BUILD_DIR) && ./throughput_bench --ops=2000 --out=$(CURDIR)/bench/results/bench_local.json
# Run the throughput bench at cluster sizes 3, 5, 7 and refresh the
# committed per-N baselines under bench/results/.
bench-scaling: build
cd $(BUILD_DIR) && ./throughput_bench --scaling --ops=$${OPS:-2000} \
--out-dir=$(CURDIR)/bench/results
# Regression gate. Produces a fresh scaling run in a temp dir and diffs it
# against the committed baselines. Fails if throughput or P99 drifts more
# than DRIFT (default 0.30 = 30%). This is what CI runs.
bench-regress: build
@mkdir -p $(BUILD_DIR)/bench_candidate
cd $(BUILD_DIR) && ./throughput_bench --scaling --ops=$${OPS:-2000} \
--out-dir=$(BUILD_DIR)/bench_candidate
$(BUILD_DIR)/bench_regress \
--baseline=$(CURDIR)/bench/results \
--candidate=$(BUILD_DIR)/bench_candidate \
--drift=$${DRIFT:-0.30}
format:
@find src tests bench -name '*.cpp' -o -name '*.h' | xargs clang-format -i
format-check:
@find src tests bench -name '*.cpp' -o -name '*.h' | xargs clang-format --dry-run --Werror
clean:
rm -rf $(BUILD_DIR)