-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
50 lines (40 loc) · 1.69 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
CARGO_TARGET_DIR ?= target
COVERAGE_PROFRAW_DIR ?= ${CARGO_TARGET_DIR}/coverage
GRCOV_OUTPUT ?= coverage-report.info
GRCOV_EXCL_START = ^\s*((log::)?(trace|debug|info|warn|error)|(debug_)?assert(_eq|_ne|_error_eq))!\($$
GRCOV_EXCL_STOP = ^\s*\)(;)?$$
GRCOV_EXCL_LINE = \s*((log::)?(trace|debug|info|warn|error)|(debug_)?assert(_eq|_ne|_error_eq))!\(.*\)(;)?$$
fmt:
cargo fmt --all --check
clippy:
cargo clippy --workspace --locked -- --deny warnings
build:
cargo build
test:
cargo nextest run --hide-progress-bar --success-output immediate --failure-output immediate
test-portable:
cargo nextest run --features portable --hide-progress-bar --success-output immediate --failure-output immediate
coverage-clean:
rm -rf "${CARGO_TARGET_DIR}/*.profraw" "${GRCOV_OUTPUT}" "${GRCOV_OUTPUT:.info=}"
coverage-install-tools:
rustup component add llvm-tools-preview
grcov --version || cargo install --locked grcov
coverage-run-unittests:
mkdir -p "${COVERAGE_PROFRAW_DIR}"
rm -f "${COVERAGE_PROFRAW_DIR}/*.profraw"
RUSTFLAGS="${RUSTFLAGS} -Cinstrument-coverage" \
LLVM_PROFILE_FILE="${COVERAGE_PROFRAW_DIR}/unittests-%p-%m.profraw" \
cargo test --all
coverage-collect-data:
grcov "${COVERAGE_PROFRAW_DIR}" --binary-path "${CARGO_TARGET_DIR}/debug/" \
-s . -t lcov --branch --ignore-not-existing \
--ignore "/*" \
--ignore "*/tests/*" \
--ignore "*/tests.rs" \
--excl-br-start "${GRCOV_EXCL_START}" --excl-br-stop "${GRCOV_EXCL_STOP}" \
--excl-start "${GRCOV_EXCL_START}" --excl-stop "${GRCOV_EXCL_STOP}" \
--excl-br-line "${GRCOV_EXCL_LINE}" \
--excl-line "${GRCOV_EXCL_LINE}" \
-o "${GRCOV_OUTPUT}"
coverage-generate-report:
genhtml -o "${GRCOV_OUTPUT:.info=}" "${GRCOV_OUTPUT}"