Adding generation of coverage files to build (#3066)

This commit is contained in:
Christopher Speller
2016-05-20 09:40:52 -04:00
parent 981a08e80e
commit 4a426be6b8
2 changed files with 39 additions and 7 deletions

3
.gitignore vendored
View File

@@ -71,6 +71,9 @@ api/data/*
enterprise
cover.out
ecover.out
.agignore
.ctags
tags

View File

@@ -153,15 +153,34 @@ check-style: check-client-style check-server-style
test-server: start-docker prepare-enterprise
@echo Running server tests
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=340s ./api || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./store || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
rm -f cover.out
echo "mode: count" > cover.out
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=340s -covermode=count -coverprofile=capi.out ./api || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s -covermode=count -coverprofile=cmodel.out ./model || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s -covermode=count -coverprofile=cstore.out ./store || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s -covermode=count -coverprofile=cutils.out ./utils || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s -covermode=count -coverprofile=cweb.out ./web || exit 1
tail -n +2 capi.out >> cover.out
tail -n +2 cmodel.out >> cover.out
tail -n +2 cstore.out >> cover.out
tail -n +2 cutils.out >> cover.out
tail -n +2 cweb.out >> cover.out
rm -f capi.out cmodel.out cstore.out cutils.out cweb.out
ifeq ($(BUILD_ENTERPRISE_READY),true)
@echo Running Enterprise tests
$(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/ldap && ./ldap.test -test.v -test.timeout=120s || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/compliance && ./compliance.test -test.v -test.timeout=120s || exit 1
rm -f ecover.out
echo "mode: count" > ecover.out
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/ldap && ./ldap.test -test.v -test.timeout=120s -test.coverprofile=cldap.out || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/compliance && ./compliance.test -test.v -test.timeout=120s -test.coverprofile=ccompliance.out || exit 1
tail -n +2 cldap.out >> ecover.out
tail -n +2 ccompliance.out >> ecover.out
rm -f cldap.out ccompliance.out
rm -r ldap.test
rm -r compliance.test
endif
@@ -176,6 +195,12 @@ test-client: start-docker prepare-enterprise
test: test-server test-client
cover:
@echo Opening coverage info in browser. If this failed run make test first
$(GO) tool cover -html=cover.out
$(GO) tool cover -html=ecover.out
.prebuild:
@echo Preparation for running go code
go get $(GOFLAGS) github.com/Masterminds/glide
@@ -330,6 +355,10 @@ clean: stop-docker
rm -f api/mattermost.log
rm -f .prepare-go
rm -f enterprise
rm -f cover.out
rm -f ecover.out
rm -f *.out
rm -f *.test
nuke: clean clean-docker
@echo BOOM