makefile: add coverage support (lcov, gcovr)
This commit is contained in:
parent
f0e1978d38
commit
9129ba88f8
1 changed files with 17 additions and 1 deletions
18
Makefile
18
Makefile
|
@ -23,6 +23,18 @@ test:
|
||||||
|
|
||||||
all: $(BUILD_TARGETS) $(TEST_TARGETS)
|
all: $(BUILD_TARGETS) $(TEST_TARGETS)
|
||||||
|
|
||||||
|
coverage: ## Run code coverage
|
||||||
|
gcov tests/*.cpp
|
||||||
|
|
||||||
|
lcov-report: coverage ## Generate lcov report
|
||||||
|
mkdir -p lcov-report
|
||||||
|
lcov --capture --directory . --output-file lcov-report/coverage.info
|
||||||
|
genhtml lcov-report/coverage.info --output-directory lcov-report
|
||||||
|
|
||||||
|
gcovr-report: coverage ## Generate gcovr report
|
||||||
|
mkdir -p gcovr-report
|
||||||
|
gcovr --root . --html --html-details --output gcovr-report/coverage.html
|
||||||
|
|
||||||
ifndef UNAME_S
|
ifndef UNAME_S
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
endif
|
endif
|
||||||
|
@ -79,6 +91,10 @@ ifdef LLAMA_SERVER_VERBOSE
|
||||||
CXXFLAGS += -DSERVER_VERBOSE=$(LLAMA_SERVER_VERBOSE)
|
CXXFLAGS += -DSERVER_VERBOSE=$(LLAMA_SERVER_VERBOSE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef LLAMA_CODE_COVERAGE
|
||||||
|
CXXFLAGS += -fprofile-arcs -ftest-coverage -dumpbase ''
|
||||||
|
endif
|
||||||
|
|
||||||
# warnings
|
# warnings
|
||||||
CFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith \
|
CFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith \
|
||||||
-Wmissing-prototypes -Werror=implicit-int
|
-Wmissing-prototypes -Werror=implicit-int
|
||||||
|
@ -391,7 +407,7 @@ libllama.so: llama.o ggml.o $(OBJS)
|
||||||
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf *.o tests/*.o *.so *.dll benchmark-matmult build-info.h $(BUILD_TARGETS) $(TEST_TARGETS)
|
rm -vrf *.o tests/*.o *.so *.dll benchmark-matmult build-info.h *.gcno tests/*.gcno *.gcda tests/*.gcda *.gcov tests/*.gcov lcov-report gcovr-report *.dot $(BUILD_TARGETS) $(TEST_TARGETS)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue