diff --git a/configure.ac b/configure.ac index 5947fa4b00..7f8a07dc25 100644 --- a/configure.ac +++ b/configure.ac @@ -254,6 +254,16 @@ AC_TRY_COMPILE([ AC_DEFINE(HAVE_SA_LEN, 1, [Define to 1 if sockaddr has a sa_len member, and corresponding sin_len and sun_len])], AC_MSG_RESULT(no)) +AC_ARG_WITH(pycoverage, +[ --with-pycoverage[=PROGRAM] enable python code coverage using the specified coverage], pycoverage="$withval", pycoverage="no") +if test "$pycoverage" != "no" ; then + PYCOVERAGE="coverage run --branch --append" +else + PYCOVERAGE="${PYTHON}" +fi +AM_CONDITIONAL(ENABLE_PYTHON_COVERAGE, test x$pycoverage != xno) +AC_SUBST(PYCOVERAGE) + AC_ARG_WITH(lcov, [ --with-lcov[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no") @@ -605,7 +615,7 @@ Features: Developer: Google Tests: $gtest_path - Code Coverage: $USE_LCOV + C++ Code Coverage: $USE_LCOV Generate Manuals: $enable_man END diff --git a/src/bin/bind10/tests/Makefile.am b/src/bin/bind10/tests/Makefile.am index 3679ad7114..45c91d9c88 100644 --- a/src/bin/bind10/tests/Makefile.am +++ b/src/bin/bind10/tests/Makefile.am @@ -1,10 +1,15 @@ +PYCOVERAGE = @PYCOVERAGE@ +#PYTESTS = args_test.py bind10_test.py PYTESTS = bind10_test.py EXTRA_DIST = $(PYTESTS) -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/bind10 \ diff --git a/src/bin/bindctl/tests/Makefile.am b/src/bin/bindctl/tests/Makefile.am index aaf15d88ee..7fb9ca1856 100644 --- a/src/bin/bindctl/tests/Makefile.am +++ b/src/bin/bindctl/tests/Makefile.am @@ -1,10 +1,14 @@ +PYCOVERAGE = @PYCOVERAGE@ PYTESTS = bindctl_test.py EXTRA_DIST = $(PYTESTS) -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_srcdir)/src/bin \ diff --git a/src/bin/cmdctl/tests/Makefile.am b/src/bin/cmdctl/tests/Makefile.am index 2c29dc1541..5351117960 100644 --- a/src/bin/cmdctl/tests/Makefile.am +++ b/src/bin/cmdctl/tests/Makefile.am @@ -1,10 +1,14 @@ +PYCOVERAGE=@PYCOVERAGE@ PYTESTS = cmdctl_test.py EXTRA_DIST = $(PYTESTS) -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/cmdctl \ diff --git a/src/bin/msgq/tests/Makefile.am b/src/bin/msgq/tests/Makefile.am index 0735aa37da..b28550e4d5 100644 --- a/src/bin/msgq/tests/Makefile.am +++ b/src/bin/msgq/tests/Makefile.am @@ -1,10 +1,14 @@ +PYCOVERAGE = @PYCOVERAGE@ PYTESTS = msgq_test.py EXTRA_DIST = $(PYTESTS) -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_builddir)/src/bin/msgq:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ diff --git a/src/bin/xfrin/tests/Makefile.am b/src/bin/xfrin/tests/Makefile.am index 9e1dde88de..efde042b87 100644 --- a/src/bin/xfrin/tests/Makefile.am +++ b/src/bin/xfrin/tests/Makefile.am @@ -1,3 +1,4 @@ +PYCOVERAGE=@PYCOVERAGE@ PYTESTS = xfrin_test.py EXTRA_DIST = $(PYTESTS) @@ -8,10 +9,13 @@ if SET_ENV_LIBRARY_PATH LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/xfr/.libs:$$$(ENV_LIBRARY_PATH) endif -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ diff --git a/src/bin/xfrout/tests/Makefile.am b/src/bin/xfrout/tests/Makefile.am index 0840b5536d..43b061e7fa 100644 --- a/src/bin/xfrout/tests/Makefile.am +++ b/src/bin/xfrout/tests/Makefile.am @@ -1,3 +1,4 @@ +PYCOVERAGE=@PYCOVERAGE@ PYTESTS = xfrout_test.py EXTRA_DIST = $(PYTESTS) @@ -8,10 +9,13 @@ if SET_ENV_LIBRARY_PATH LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/xfr/.libs:$$$(ENV_LIBRARY_PATH) endif -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_builddir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \ diff --git a/src/bin/zonemgr/tests/Makefile.am b/src/bin/zonemgr/tests/Makefile.am index 5592fbd92f..0870db1012 100644 --- a/src/bin/zonemgr/tests/Makefile.am +++ b/src/bin/zonemgr/tests/Makefile.am @@ -1,10 +1,14 @@ +PYCOVERAGE=@PYCOVERAGE@ PYTESTS = zonemgr_test.py EXTRA_DIST = $(PYTESTS) -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_builddir)/src/bin/zonemgr:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \ diff --git a/src/lib/python/isc/cc/tests/Makefile.am b/src/lib/python/isc/cc/tests/Makefile.am index 929110d2fa..7bfd390877 100644 --- a/src/lib/python/isc/cc/tests/Makefile.am +++ b/src/lib/python/isc/cc/tests/Makefile.am @@ -1,13 +1,18 @@ +PYCOVERAGE = @PYCOVERAGE@ + PYTESTS = message_test.py data_test.py session_test.py # NOTE: test_session.py is to be run manually, so not automated. EXTRA_DIST = $(PYTESTS) EXTRA_DIST += sendcmd.py EXTRA_DIST += test_session.py -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ diff --git a/src/lib/python/isc/config/tests/Makefile.am b/src/lib/python/isc/config/tests/Makefile.am index e4f6d7a1c0..4364e439fd 100644 --- a/src/lib/python/isc/config/tests/Makefile.am +++ b/src/lib/python/isc/config/tests/Makefile.am @@ -1,12 +1,16 @@ +PYCOVERAGE=@PYCOVERAGE@ PYTESTS = ccsession_test.py cfgmgr_test.py config_data_test.py PYTESTS += module_spec_test.py EXTRA_DIST = $(PYTESTS) EXTRA_DIST += unittest_fakesession.py -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ diff --git a/src/lib/python/isc/notify/tests/Makefile.am b/src/lib/python/isc/notify/tests/Makefile.am index 061e535015..1ca462df71 100644 --- a/src/lib/python/isc/notify/tests/Makefile.am +++ b/src/lib/python/isc/notify/tests/Makefile.am @@ -1,3 +1,4 @@ +PYCOVERAGE=@PYCOVERAGE@ PYTESTS = notify_out_test.py EXTRA_DIST = $(PYTESTS) @@ -8,10 +9,13 @@ if SET_ENV_LIBRARY_PATH LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$$$(ENV_LIBRARY_PATH) endif -# later will have configure option to choose this, like: coverage run --branch -PYCOVERAGE = $(PYTHON) # test using command-line arguments, so use check-local target instead of TESTS check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs \