summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-07-21 14:54:57 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-07-21 15:46:43 +0200
commita05c15da2f0b291ac1c40fac5bbf6e52cd659b6f (patch)
tree79749a6dc49c6bd33d9c97f8fe48b1d751745738 /Makefile
parent644b5bc8a35760654824c46cad8618e0d6e634bc (diff)
downloadpodman-a05c15da2f0b291ac1c40fac5bbf6e52cd659b6f.tar.gz
podman-a05c15da2f0b291ac1c40fac5bbf6e52cd659b6f.tar.bz2
podman-a05c15da2f0b291ac1c40fac5bbf6e52cd659b6f.zip
make localunit: record coverage
Inspirsed by CRI-O's coverage logic. Initial coverage is at 15.7 percent. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 132dde939..983ab46be 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ export GO111MODULE=off
export GOPROXY=https://proxy.golang.org
GO ?= go
+COVERAGE_PATH ?= .coverage
DESTDIR ?=
EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-master} HEAD)
HEAD ?= HEAD
@@ -308,14 +309,20 @@ testunit: libpodimage ## Run unittest on the built image
.PHONY: localunit
localunit: test/goecho/goecho varlink_generate
hack/check_root.sh make localunit
+ rm -rf ${COVERAGE_PATH} && mkdir -p ${COVERAGE_PATH}
ginkgo \
-r \
$(TESTFLAGS) \
--skipPackage test/e2e,pkg/apparmor,test/endpoint,pkg/bindings,hack \
--cover \
--covermode atomic \
+ --coverprofile coverprofile \
+ --outputdir ${COVERAGE_PATH} \
--tags "$(BUILDTAGS)" \
--succinct
+ $(GO) tool cover -html=${COVERAGE_PATH}/coverprofile -o ${COVERAGE_PATH}/coverage.html
+ $(GO) tool cover -func=${COVERAGE_PATH}/coverprofile > ${COVERAGE_PATH}/functions
+ cat ${COVERAGE_PATH}/functions | sed -n 's/\(total:\).*\([0-9][0-9].[0-9]\)/\1 \2/p'
.PHONY: ginkgo
ginkgo: