forked from utilityai/llama-cpp-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (69 loc) · 2.44 KB
/
Copy pathMakefile
File metadata and controls
86 lines (69 loc) · 2.44 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
TEST_DEVICE ?=
DEVICE_FEATURE = $(if $(TEST_DEVICE),--features $(TEST_DEVICE),)
node_modules: package-lock.json
npm ci
touch node_modules
package-lock.json: package.json
npm install --package-lock-only
.PHONY: clean.cmake
clean.cmake:
rm -rf target/llama-cpp-cmake-build
.PHONY: clippy
clippy:
cargo clippy --workspace --all-targets $(DEVICE_FEATURE) -- -D warnings
.PHONY: coverage
coverage: node_modules
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --no-fail-fast --workspace $(DEVICE_FEATURE)
cargo llvm-cov report --json --output-path target/llvm-cov.json
cargo llvm-cov report --lcov --output-path target/lcov.info
cargo llvm-cov report
npx rust-coverage-check target/llvm-cov.json \
--workspace-root $(CURDIR) \
--gated llama-cpp-bindings=98 \
--gated llama-cpp-error-recorder=100 \
--gated llama-cpp-log-decoder=100 \
--gated llama-cpp-bindings-types=100 \
--gated llama-cpp-test-harness=99 \
--gated llama-cpp-test-harness-macros=100
.PHONY: coverage-clean
coverage-clean:
cargo llvm-cov clean --workspace
rm -rf target/llvm-cov-target
rm -f target/llvm-cov.json target/lcov.info
.PHONY: coverage-report
coverage-report:
cargo llvm-cov report --html
.PHONY: fmt
fmt:
cargo fmt --all
.PHONY: fmt.check
fmt.check:
cargo fmt --all --check
.PHONY: lint.cpp
lint.cpp: lint.cpp.clang-tidy lint.cpp.cppcheck
.PHONY: lint.cpp.clang-tidy
lint.cpp.clang-tidy:
cd llama-cpp-bindings-sys && clang-tidy wrapper_*.cpp -- \
-std=c++17 -I. -IGSL/include -Illama.cpp -Illama.cpp/common \
-Illama.cpp/include -Illama.cpp/ggml/include -Illama.cpp/vendor
.PHONY: lint.cpp.cppcheck
lint.cpp.cppcheck:
cd llama-cpp-bindings-sys && cppcheck --enable=all --inconclusive \
--check-level=exhaustive --std=c++17 --error-exitcode=1 \
-I. -IGSL/include -Illama.cpp -Illama.cpp/common -Illama.cpp/include \
-Illama.cpp/ggml/include -Illama.cpp/vendor \
--suppress='*:llama.cpp/*' --suppress='*:GSL/*' \
--suppress=missingIncludeSystem --suppress=unusedFunction \
--suppress=checkersReport --suppress=toomanyconfigs wrapper_*.cpp
.PHONY: test
test: test.unit test.llms
.PHONY: test.harness
test.harness: clippy
cargo test -p llama-cpp-test-harness-macros -p llama-cpp-test-harness $(DEVICE_FEATURE)
.PHONY: test.llms
test.llms: clippy test.harness test.unit
cargo test --no-fail-fast -p llama-cpp-bindings-tests $(DEVICE_FEATURE)
.PHONY: test.unit
test.unit: clippy
cargo test -p llama-cpp-log-decoder -p llama-cpp-bindings $(DEVICE_FEATURE)