makefile: Add test-cover-html
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 27 Nov 2016 22:21:10 +0000 (23:21 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 27 Nov 2016 22:21:10 +0000 (23:21 +0100)
.gitignore
Makefile

index 5b726dc043bee81590c44e8f1f70538974be9ba7..f72d3ad7ad40819b1415506a54ad884265dc09d1 100644 (file)
@@ -11,4 +11,5 @@ cover.out
 .DS_Store\r
 *~\r
 vendor/*/
-*.bench
\ No newline at end of file
+*.bench
+coverage*.out
\ No newline at end of file
index 684e1d1be0ec14113ddf0be46608b1fa78824bae..6d5aeed182fa1a84f6282cb2ed3a851c8ab3569c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@
 COMMIT_HASH=`git rev-parse --short HEAD 2>/dev/null`
 BUILD_DATE=`date +%FT%T%z`
 LDFLAGS=-ldflags "-X github.com/spf13/hugo/hugolib.CommitHash=${COMMIT_HASH} -X github.com/spf13/hugo/hugolib.BuildDate=${BUILD_DATE}"
+PACKAGES = $(shell govendor list -no-status +local | sed 's/github.com.spf13.hugo/./')
 
 all: gitinfo
 
@@ -74,3 +75,9 @@ vet:
                echo "^ go vet errors!" && echo && exit 1; \
        fi
 
+test-cover-html:
+       echo "mode: count" > coverage-all.out
+       $(foreach pkg,$(PACKAGES),\
+               govendor test -coverprofile=coverage.out -covermode=count $(pkg);\
+               tail -n +2 coverage.out >> coverage-all.out;)
+       go tool cover -html=coverage-all.out
\ No newline at end of file