From 8136f0edc3da9878808a4bab1cd38f59a3a282b2 Mon Sep 17 00:00:00 2001 From: Abhinandan Purkait Date: Mon, 18 Mar 2024 06:47:53 +0000 Subject: [PATCH] chore: use test-cov script to run test and generate report Signed-off-by: Abhinandan Purkait --- Makefile | 4 ++-- buildscripts/test-cov.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6cceceae..9562d6a7 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # list only csi source code directories PACKAGES = $(shell go list ./... | grep -v 'pkg/generated') -UNIT_TEST_PACKAGES = $(shell go list ./... | grep -v 'pkg/generated\|tests') +# UNIT_TEST_PACKAGES = $(shell go list ./... | grep -v 'pkg/generated\|tests') # Lint our code. Reference: https://golang.org/cmd/vet/ VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \ @@ -110,7 +110,7 @@ format: .PHONY: test test: format @echo "--> Running go test" ; - @go test $(UNIT_TEST_PACKAGES) -cover -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt + @./buildscripts/test-cov.sh .PHONY: deps diff --git a/buildscripts/test-cov.sh b/buildscripts/test-cov.sh index be9c8fa1..a17b2c63 100755 --- a/buildscripts/test-cov.sh +++ b/buildscripts/test-cov.sh @@ -17,7 +17,7 @@ set -e echo "" > coverage.txt -for d in $(go list ./... | grep -v 'vendor\|pkg/apis\|pkg/generated\|tests'); do +for d in $(go list ./... | grep -v 'pkg/generated\|tests'); do #TODO - Include -race while creating the coverage profile. go test -coverprofile=profile.out -covermode=atomic $d if [ -f profile.out ]; then