Skip to content

Commit

Permalink
chore: use test-cov script to run test and generate report
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinandan Purkait <[email protected]>
  • Loading branch information
Abhinandan-Purkait committed Mar 18, 2024
1 parent 9e65a85 commit 466ec71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions buildscripts/test-cov.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

# Copyright © 2020 The OpenEBS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,12 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash

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
Expand Down

0 comments on commit 466ec71

Please sign in to comment.