mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-05 21:21:44 +00:00
Add -cover flag to go test
Make go test (make check) report the coverage percentage of the unit tests that run. Add checkcoverage target to generate a coverage.out file for a given package. Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This commit is contained in:
@@ -45,7 +45,16 @@ install: gopath
|
||||
install -D -m 00644 yum.conf.in $(DESTDIR)/usr/share/defaults/mixer/yum.conf.in
|
||||
|
||||
check: gopath
|
||||
go test ${GO_PACKAGE_PREFIX}/...
|
||||
go test -cover ${GO_PACKAGE_PREFIX}/...
|
||||
|
||||
# TODO: when Go 1.10 comes out we will have support for passing multiple packages
|
||||
# to coverprofile, so there will be no need to pass an individual package.
|
||||
# At that time we can merge this target into check and run it against all
|
||||
# packages every time.
|
||||
checkcoverage: gopath
|
||||
test ${PKG}
|
||||
go test -cover ${GO_PACKAGE_PREFIX}/${PKG} -coverprofile=coverage.out
|
||||
go tool cover -html=coverage.out
|
||||
|
||||
.PHONY: lint
|
||||
lint: gopath
|
||||
|
||||
Reference in New Issue
Block a user