Commits

Kirill Simonov committed aaa9a24

make coverage: check code coverage of the regression tests

Comments (0)

Files changed (2)

 .PHONY: default build install deps develop doc dist windist pypi clean \
 	test train test-routine train-routine test-sqlite train-sqlite \
 	test-pgsql train-pgsql test-mysql train-mysql test-oracle train-oracle \
-	test-mssql train-mssql purge-test lint \
+	test-mssql train-mssql purge-test lint coverage \
 	create-sqlite create-pgsql create-mysql create-oracle create-mssql \
 	drop-sqlite drop-pgsql drop-mysql drop-oracle drop-mssql \
 	build-all check-all start-pgsql84 start-pgsql90 start-mysql51 \
 	@echo "    where <db> is one of:"
 	@echo "        sqlite, pgsql, mysql, oracle, mssql"
 	@echo "  lint: detect errors in the source code"
+	@echo "  coverage: measure code coverage of regression tests"
 	@echo
 	@echo "  *** Integration Testing ***"
 	@echo "  build-all: to build all test benches"
 lint:
 	${PYFLAKES} src/htsql src/htsql_pgsql src/htsql_sqlite
 
+# Measure code coverage of regression tests (requires coverage)
+coverage:
+	rm -rf build/coverage
+	mkdir -p build/coverage
+	COVERAGE_FILE=build/coverage/coverage.dat \
+	${COVERAGE} run --branch --source=htsql,htsql_sqlite,htsql_pgsql,htsql_mysql,htsql_oracle,htsql_mssql,htsql_tweak \
+	`which ${HTSQL_CTL}` regress -i test/regress.yaml -q
+	COVERAGE_FILE=build/coverage/coverage.dat \
+	${COVERAGE} html --directory=build/coverage
+
 # Install the regression database for SQLite.
 create-sqlite:
 	${HTSQL_CTL} regress -i test/regress.yaml -q create-sqlite
 PIP?=pip
 SPHINX_BUILD?=sphinx-build
 PYFLAKES?=pyflakes
+COVERAGE?=coverage
 
 
 #