@@ -135,16 +135,17 @@ test: fmt-check
135
135
$(GO ) test $(PACKAGES )
136
136
137
137
.PHONY : coverage
138
- coverage : unit-test-coverage integration-test-coverage
138
+ coverage :
139
139
@hash gocovmerge > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
140
140
$(GO ) get -u github.com/wadey/gocovmerge; \
141
141
fi
142
+ echo " mode: set" > coverage.all
142
143
for PKG in $( PACKAGES) ; do\
143
- touch $$ GOPATH/src/ $$ PKG/ coverage.out; \
144
- egrep " $$ PKG[^/]*\.go " integration .coverage.out > int .coverage.out; \
145
- gocovmerge $$ GOPATH/src/ $$ PKG/coverage.out int .coverage.out > pkg. coverage.out ; \
146
- mv pkg.coverage.out $$ GOPATH/src/$$ PKG/coverage.out; \
147
- rm int.coverage.out; \
144
+ egrep " $$ PKG[^/]*\.go " integration.coverage.out > int. coverage.out; \
145
+ gocovmerge $$ GOPATH/src/ $$ PKG/coverage.out int .coverage.out > pkg .coverage.out; \
146
+ grep -h -v " ^mode: " pkg .coverage.out >> coverage.all ; \
147
+ mv pkg.coverage.out $$ GOPATH/src/$$ PKG/coverage.out; \
148
+ rm int.coverage.out; \
148
149
done ;
149
150
150
151
.PHONY : unit-test-coverage
@@ -168,39 +169,41 @@ test-vendor:
168
169
test-sqlite : integrations.sqlite.test
169
170
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
170
171
171
- .PHONY : test-mysql
172
- test-mysql : integrations.mysql.test
172
+ generate-ini :
173
173
sed -e ' s|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
174
- -e ' s|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
175
- -e ' s|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
176
- -e ' s|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
177
- integrations/mysql.ini.tmpl > integrations/mysql.ini
174
+ -e ' s|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
175
+ -e ' s|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
176
+ -e ' s|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
177
+ integrations/mysql.ini.tmpl > integrations/mysql.ini
178
+ sed -e ' s|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
179
+ -e ' s|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
180
+ -e ' s|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
181
+ -e ' s|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
182
+ integrations/pgsql.ini.tmpl > integrations/pgsql.ini
183
+
184
+ .PHONY : test-mysql
185
+ test-mysql : integrations.mysql.test generate-ini
178
186
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test
179
187
180
188
.PHONY : test-pgsql
181
- test-pgsql : integrations.pgsql.test
182
- sed -e ' s|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
183
- -e ' s|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
184
- -e ' s|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
185
- -e ' s|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
186
- integrations/pgsql.ini.tmpl > integrations/pgsql.ini
189
+ test-pgsql : integrations.pgsql.test generate-ini
187
190
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test
188
191
189
192
.PHONY : bench-sqlite
190
193
bench-sqlite : integrations.sqlite.test
191
194
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.bench .
192
195
193
196
.PHONY : bench-mysql
194
- bench-mysql : integrations.mysql.test
197
+ bench-mysql : integrations.mysql.test generate-ini
195
198
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.bench .
196
199
197
200
.PHONY : bench-pgsql
198
- bench-pgsql : integrations.pgsql.test
201
+ bench-pgsql : integrations.pgsql.test generate-ini
199
202
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.bench .
200
203
201
204
202
205
.PHONY : integration-test-coverage
203
- integration-test-coverage : integrations.cover.test
206
+ integration-test-coverage : integrations.cover.test generate-ini
204
207
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
205
208
206
209
integrations.mysql.test : $(SOURCES )
0 commit comments