CLEANFILES =
CLEAN_LOCAL =
DISTCLEANFILES =
+PYCOV_CLEAN_FILES = build-aux/check-structs,cover
EXTRA_DIST = \
CodingStyle \
DESIGN \
fi
mv $@.tmp $@
+.PHONY: clean-pycov
+clean-pycov:
+ cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
+CLEAN_LOCAL += clean-pycov
+
# If we're checked out from a Git repository, make sure that every
# file that is in Git is distributed.
ALL_LOCAL += dist-hook-git
python/ovs/timeval.py \
python/ovs/vlog.py \
python/ovs/util.py
-EXTRA_DIST += $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)
+PYFILES = $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)
+EXTRA_DIST += $(PYFILES)
+PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover)
if HAVE_PYTHON
nobase_pkgdata_DATA = $(ovs_pyfiles) $(ovstest_pyfiles)
HAVE_OPENSSL='@HAVE_OPENSSL@'
HAVE_PYTHON='@HAVE_PYTHON@'
PERL='@PERL@'
-PYTHON='@PYTHON@'
+
+if test x"$PYTHON" = x; then
+ PYTHON='@PYTHON@'
+fi
PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
export PYTHONPATH
else
PYTHONPATH=$PYTHONPATH:$abs_top_srcdir/python/compat
export PYTHONPATH
- fi
+ fi
fi
check-local: tests/atconfig tests/atlocal $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
\f
+# Python Coverage support.
+# Requires coverage.py http://nedbatchelder.com/code/coverage/.
+
+COVERAGE = coverage
+COVERAGE_FILE='$(abs_srcdir)/.coverage'
+check-pycov: all tests/atconfig tests/atlocal $(TESTSUITE) clean-pycov
+ COVERAGE_FILE=$(COVERAGE_FILE) PYTHON='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
+ @cd $(srcdir) && $(COVERAGE) combine && COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) annotate
+ @echo
+ @echo '----------------------------------------------------------------------'
+ @echo 'Annotated coverage source has the ",cover" extension.'
+ @echo '----------------------------------------------------------------------'
+ @echo
+ @COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) report
+\f
# lcov support
lcov_wrappers = \
EXTRA_DIST += tests/choose-port.pl
# Python tests.
-EXTRA_DIST += \
+CHECK_PYFILES = \
tests/test-daemon.py \
tests/test-json.py \
tests/test-jsonrpc.py \
tests/test-reconnect.py \
tests/MockXenAPI.py \
tests/test-vlog.py
+EXTRA_DIST += $(CHECK_PYFILES)
+PYCOV_CLEAN_FILES += $(CHECK_PYFILES:.py=.py,cover) .coverage
if HAVE_OPENSSL
TESTPKI_FILES = \