-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (107 loc) · 5.92 KB
/
Copy pathMakefile
File metadata and controls
132 lines (107 loc) · 5.92 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
# Helper variables (override on invocation if needed).
CARGO ?= cargo
GRCOV ?= grcov
WASM_PACK ?= wasm-pack
SQLLOGIC_PATH ?= tests/slt/**/*.slt
PYO3_PYTHON ?= /usr/bin/python3.12
TPCC_MEASURE_TIME ?= 15
TPCC_NUM_WARE ?= 1
TPCC_PPROF_OUTPUT ?= /tmp/tpcc_lmdb.svg
TPCC_HEAPTRACK_MEASURE_TIME ?= 300
TPCC_HEAPTRACK_OUTPUT ?= /tmp/tpcc_lmdb_heaptrack
TPCC_SQLITE_PROFILE ?= balanced
CODECOV_OUTPUT ?= lcov.info
COVERAGE_PROFILE_DIR ?= target/grcov/profraw
COVERAGE_HTML_DIR ?= target/grcov/html
COVERAGE_RUSTFLAGS ?= -Cinstrument-coverage
COVERAGE_REPORT_ARGS ?= --llvm --ignore-not-existing --keep-only 'src/**' --ignore 'src/**/tests/**' --ignore 'tests/**' --ignore 'tpcc/**' --excl-start 'GRCOV_EXCL_START' --excl-stop 'GRCOV_EXCL_STOP'
.PHONY: test test-python test-wasm test-slt test-all codecov codecov-html wasm-build check tpcc tpcc-kitesql-rocksdb tpcc-kitesql-lmdb tpcc-lmdb-flamegraph tpcc-lmdb-heaptrack tpcc-sqlite tpcc-sqlite-practical tpcc-sqlite-balanced tpcc-dual cargo-check build wasm-examples native-examples fmt clippy
## Run default Rust tests in the current environment (non-WASM).
test:
$(CARGO) test --all
## Run Python binding API tests implemented with pyo3.
test-python:
PYO3_PYTHON=$(PYO3_PYTHON) $(CARGO) test --features python,decimal test_python_
## Perform a `cargo check` across the workspace.
cargo-check:
$(CARGO) check
## Build the workspace artifacts (debug).
build:
$(CARGO) build
## Build the WebAssembly package (artifact goes to ./pkg).
wasm-build:
$(WASM_PACK) build --release --target nodejs -- --features wasm
## Execute wasm-bindgen tests under Node.js (wasm32 target).
test-wasm:
$(WASM_PACK) test --node -- --features wasm --package kite_sql --lib
## Run the sqllogictest harness against the configured .slt suite.
test-slt:
$(CARGO) run -p sqllogictest-test -- --path '$(SQLLOGIC_PATH)'
## Convenience target to run every suite in sequence.
test-all: test test-wasm test-slt test-python
## Generate an lcov coverage report for Codecov upload.
codecov:
bash -c "set -euo pipefail; \
command -v $(GRCOV) >/dev/null || { echo 'grcov is not installed; run: cargo install grcov'; exit 1; }; \
rm -rf '$(COVERAGE_PROFILE_DIR)' '$(CODECOV_OUTPUT)'; \
mkdir -p '$(COVERAGE_PROFILE_DIR)'; \
CARGO_INCREMENTAL=0 RUSTFLAGS=\"$${RUSTFLAGS:-} $(COVERAGE_RUSTFLAGS)\" LLVM_PROFILE_FILE='$(COVERAGE_PROFILE_DIR)/kitesql-%p-%m.profraw' $(CARGO) test --all --features decimal; \
CARGO_INCREMENTAL=0 RUSTFLAGS=\"$${RUSTFLAGS:-} $(COVERAGE_RUSTFLAGS)\" LLVM_PROFILE_FILE='$(COVERAGE_PROFILE_DIR)/kitesql-%p-%m.profraw' $(CARGO) run -p sqllogictest-test -- --path '$(SQLLOGIC_PATH)'; \
$(GRCOV) . --binary-path \"$${CARGO_TARGET_DIR:-target}/debug\" -s . -t lcov $(COVERAGE_REPORT_ARGS) -o '$(CODECOV_OUTPUT)'"
## Generate a local HTML coverage report.
codecov-html:
bash -c "set -euo pipefail; \
command -v $(GRCOV) >/dev/null || { echo 'grcov is not installed; run: cargo install grcov'; exit 1; }; \
rm -rf '$(COVERAGE_PROFILE_DIR)' '$(COVERAGE_HTML_DIR)'; \
mkdir -p '$(COVERAGE_PROFILE_DIR)' '$(COVERAGE_HTML_DIR)'; \
CARGO_INCREMENTAL=0 RUSTFLAGS=\"$${RUSTFLAGS:-} $(COVERAGE_RUSTFLAGS)\" LLVM_PROFILE_FILE='$(COVERAGE_PROFILE_DIR)/kitesql-%p-%m.profraw' $(CARGO) test --all --features decimal; \
CARGO_INCREMENTAL=0 RUSTFLAGS=\"$${RUSTFLAGS:-} $(COVERAGE_RUSTFLAGS)\" LLVM_PROFILE_FILE='$(COVERAGE_PROFILE_DIR)/kitesql-%p-%m.profraw' $(CARGO) run -p sqllogictest-test -- --path '$(SQLLOGIC_PATH)'; \
$(GRCOV) . --binary-path \"$${CARGO_TARGET_DIR:-target}/debug\" -s . -t html $(COVERAGE_REPORT_ARGS) -o '$(COVERAGE_HTML_DIR)'"
@echo "Coverage report: $(COVERAGE_HTML_DIR)/index.html"
## Run formatting (check mode) across the workspace.
fmt:
$(CARGO) fmt --all -- --check
## Execute clippy across all targets/features with warnings elevated to errors.
clippy:
$(CARGO) clippy --all-targets --all-features -- -D warnings
## Run formatting (check mode) and clippy linting together.
check: fmt clippy
tpcc: tpcc-kitesql-lmdb
## Execute the TPCC workload on KiteSQL with RocksDB storage.
tpcc-kitesql-rocksdb:
$(CARGO) run -p tpcc --release -- --backend kitesql-rocksdb
## Execute the TPCC workload on KiteSQL with LMDB storage.
tpcc-kitesql-lmdb:
$(CARGO) run -p tpcc --release -- --backend kitesql-lmdb
## Execute TPCC on LMDB and emit a pprof flamegraph SVG.
tpcc-lmdb-flamegraph:
CARGO_PROFILE_RELEASE_DEBUG=true $(CARGO) run -p tpcc --release --features pprof -- --backend kitesql-lmdb --measure-time $(TPCC_MEASURE_TIME) --num-ware $(TPCC_NUM_WARE) --pprof-output $(TPCC_PPROF_OUTPUT)
## Execute TPCC on LMDB under heaptrack and emit a heap profile.
tpcc-lmdb-heaptrack:
@command -v heaptrack >/dev/null || { echo "heaptrack is not installed"; exit 1; }
$(CARGO) build -p tpcc --release
@mkdir -p $(dir $(TPCC_HEAPTRACK_OUTPUT))
heaptrack -o $(TPCC_HEAPTRACK_OUTPUT) ./target/release/tpcc --backend kitesql-lmdb --measure-time $(TPCC_HEAPTRACK_MEASURE_TIME) --num-ware $(TPCC_NUM_WARE)
@echo "heaptrack output:"
@ls -1 $(TPCC_HEAPTRACK_OUTPUT)*
@echo "open gui: heaptrack_gui $$(ls -1 $(TPCC_HEAPTRACK_OUTPUT)* | tail -n 1)"
## Execute the TPCC workload on SQLite with the practical profile.
tpcc-sqlite:
$(CARGO) run -p tpcc --release -- --backend sqlite --sqlite-profile $(TPCC_SQLITE_PROFILE) --path kite_sql_tpcc.sqlite
## Execute the TPCC workload on SQLite with the practical profile.
tpcc-sqlite-practical:
$(MAKE) tpcc-sqlite TPCC_SQLITE_PROFILE=practical
## Execute the TPCC workload on SQLite with the balanced profile.
tpcc-sqlite-balanced:
$(MAKE) tpcc-sqlite TPCC_SQLITE_PROFILE=balanced
## Execute TPCC while mirroring every statement to an in-memory SQLite instance for validation.
tpcc-dual:
$(CARGO) run -p tpcc --release -- --backend dual --measure-time 60
## Run JavaScript-based Wasm example scripts.
wasm-examples:
node examples/wasm_hello_world.test.mjs
node examples/wasm_index_usage.test.mjs
## Run the native (non-Wasm) example binaries.
native-examples:
$(CARGO) run --example hello_world
$(CARGO) run --example transaction