aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-06-15 05:38:33 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2017-06-15 17:38:33 +0800
commit792cde7081075e63df7f42aaee14d819ff248d26 (patch)
treedc85dc2d4f132d9d4f961b342f99564be7fde1e4 /Makefile
parent033aaf4b38931d08926b9c779937577913192aa1 (diff)
downloadgitea-792cde7081075e63df7f42aaee14d819ff248d26.tar.gz
gitea-792cde7081075e63df7f42aaee14d819ff248d26.zip
Coverage reports for integration tests (#1960)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 23 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 0b9935fc05..a0f73658ae 100644
--- a/Makefile
+++ b/Makefile
@@ -107,7 +107,17 @@ test: fmt-check
go test $(PACKAGES)
.PHONY: test-coverage
-test-coverage:
+test-coverage: unit-test-coverage integration-test-coverage
+ for PKG in $(PACKAGES); do\
+ touch $$GOPATH/src/$$PKG/coverage.out;\
+ egrep "$$PKG[^/]*\.go" integration.coverage.out > int.coverage.out;\
+ gocovmerge $$GOPATH/src/$$PKG/coverage.out int.coverage.out > pkg.coverage.out;\
+ mv pkg.coverage.out $$GOPATH/src/$$PKG/coverage.out;\
+ rm int.coverage.out;\
+ done;
+
+.PHONY: unit-test-coverage
+unit-test-coverage:
for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
.PHONY: test-vendor
@@ -124,9 +134,8 @@ test-vendor:
govendor status || exit 1
.PHONY: test-sqlite
-test-sqlite:
- go test -c code.gitea.io/gitea/integrations -tags 'sqlite'
- GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.test
+test-sqlite: integrations.sqlite.test
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
.PHONY: test-mysql
test-mysql: integrations.test
@@ -136,9 +145,19 @@ test-mysql: integrations.test
test-pgsql: integrations.test
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test
+.PHONY: integration-test-coverage
+integration-test-coverage: integrations.cover.test
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
+
integrations.test: $(SOURCES)
go test -c code.gitea.io/gitea/integrations
+integrations.sqlite.test: $(SOURCES)
+ go test -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite'
+
+integrations.cover.test: $(SOURCES)
+ go test -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test
+
.PHONY: check
check: test