agent: makefile: Add codecov target

Add target to run codecov report locally.

Useful to identify what are the missing lines
to be covered by unit test.

Fixes: #1487

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
This commit is contained in:
Carlos Venegas 2021-03-03 19:29:40 +00:00 committed by Carlos Venegas
parent 6e1ef809e1
commit 7ae349c511
2 changed files with 23 additions and 0 deletions

1
src/agent/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
tarpaulin-report.html

View File

@ -150,6 +150,7 @@ install: install-services
clean:
@cargo clean
@rm -f $(GENERATED_FILES)
@rm -f tarpaulin-report.html
#TARGET test: run cargo tests
test:
@ -195,6 +196,27 @@ help: Makefile show-summary
@echo "Targets:"
@sed -n 's/^##TARGET//p' $< | sort
TARPAULIN_ARGS:=-v --workspace
install-tarpaulin:
cargo install cargo-tarpaulin
# Check if cargo tarpaulin is installed
HAS_TARPAULIN:= $(shell cargo --list | grep tarpaulin 2>/dev/null)
check_tarpaulin:
ifndef HAS_TARPAULIN
$(error "tarpaulin is not available please: run make install-tarpaulin ")
else
$(info OK: tarpaulin installed)
endif
##TARGET codecov: Generate code coverage report
codecov: check_tarpaulin
cargo tarpaulin $(TARPAULIN_ARGS)
##TARGET codecov-html: Generate code coverage html report
codecov-html: check_tarpaulin
cargo tarpaulin $(TARPAULIN_ARGS) -o Html
.PHONY: \
help \
show-header \