forked from cberner/redb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (62 loc) · 2.02 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
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
.PHONY: build
build: pre
> cargo build --all-targets
> cargo doc
.PHONY: pre
pre:
> cargo deny check licenses
> cargo fmt --all -- --check
> cargo clippy --all --all-targets
.PHONY: release
release: pre
> cargo build --release
.PHONY: flamegraph
flamegraph:
> cargo flamegraph --bench lmdb_benchmark
> firefox ./flamegraph.svg
.PHONY: publish_py
publish_py: test_py
> docker pull quay.io/pypa/manylinux2014_x86_64
> docker run -it --rm -v $(shell pwd):/redb-ro:ro quay.io/pypa/manylinux2014_x86_64 /redb-ro/py_publish.sh
.PHONY: test_py
test_py: install_py
> python3 -m unittest discover
.PHONY: install_py
install_py: pre
> maturin develop
.PHONY: test
test: pre
> RUST_BACKTRACE=1 cargo test
.PHONY: bench
bench: pre
> cargo bench --bench lmdb_benchmark
# Nightly version selected from: https://rust-lang.github.io/rustup-components-history/
NIGHTLY := "nightly-2022-09-10"
.PHONY: fuzz
fuzz: pre
> rustup toolchain install $(NIGHTLY)
> cargo +$(NIGHTLY) fuzz run fuzz_redb -- -max_len=1000000
RUST_SYSROOT := $(shell cargo +$(NIGHTLY) rustc -- --print sysroot 2>/dev/null)
LLVM_COV := $(shell find $(RUST_SYSROOT) -name llvm-cov)
.PHONY: fuzz_coverage
fuzz_coverage: pre
> echo $(LLVM_COV)
> rustup component add llvm-tools-preview --toolchain $(NIGHTLY)
> cargo +$(NIGHTLY) fuzz coverage fuzz_redb
> $(LLVM_COV) show fuzz/target/*/release/fuzz_redb --format html \
-instr-profile=fuzz/coverage/fuzz_redb/coverage.profdata \
-ignore-filename-regex='.*(cargo/registry|redb/fuzz|rustc).*' > fuzz/coverage/coverage_report.html
> $(LLVM_COV) report fuzz/target/*/release/fuzz_redb \
-instr-profile=fuzz/coverage/fuzz_redb/coverage.profdata \
-ignore-filename-regex='.*(cargo/registry|redb/fuzz|rustc).*'
> firefox ./fuzz/coverage/coverage_report.html