Browse Source

This is for ticket #153.

Moved msgq tests to own directory.

Added targets for all known python unittests.
Note this is for those that use the unittest module.
Other tests are ignored for now.

These tests are ran using "make check" even if not built
with gtest.

Some of these tests fail. I will comment them out in later commit.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac153@1753 e5f2f494-b856-4b98-b285-d166d9295462
Jeremy C. Reed 15 years ago
parent
commit
5c10d34b68

+ 10 - 2
configure.ac

@@ -361,16 +361,22 @@ AC_CONFIG_FILES([Makefile
                  src/Makefile
                  src/Makefile
                  src/bin/Makefile
                  src/bin/Makefile
                  src/bin/bind10/Makefile
                  src/bin/bind10/Makefile
+                 src/bin/bind10/tests/Makefile
                  src/bin/cmdctl/Makefile
                  src/bin/cmdctl/Makefile
+                 src/bin/cmdctl/tests/Makefile
                  src/bin/bindctl/Makefile
                  src/bin/bindctl/Makefile
+                 src/bin/bindctl/tests/Makefile
                  src/bin/cfgmgr/Makefile
                  src/bin/cfgmgr/Makefile
                  src/bin/host/Makefile
                  src/bin/host/Makefile
                  src/bin/loadzone/Makefile
                  src/bin/loadzone/Makefile
                  src/bin/msgq/Makefile
                  src/bin/msgq/Makefile
+                 src/bin/msgq/tests/Makefile
                  src/bin/auth/Makefile
                  src/bin/auth/Makefile
                  src/bin/auth/tests/Makefile
                  src/bin/auth/tests/Makefile
                  src/bin/xfrin/Makefile
                  src/bin/xfrin/Makefile
+                 src/bin/xfrin/tests/Makefile
                  src/bin/xfrout/Makefile
                  src/bin/xfrout/Makefile
+                 src/bin/xfrout/tests/Makefile
                  src/bin/usermgr/Makefile
                  src/bin/usermgr/Makefile
                  src/lib/Makefile
                  src/lib/Makefile
                  src/lib/cc/Makefile
                  src/lib/cc/Makefile
@@ -378,7 +384,9 @@ AC_CONFIG_FILES([Makefile
                  src/lib/python/isc/Makefile
                  src/lib/python/isc/Makefile
                  src/lib/python/isc/auth/Makefile
                  src/lib/python/isc/auth/Makefile
                  src/lib/python/isc/cc/Makefile
                  src/lib/python/isc/cc/Makefile
+                 src/lib/python/isc/cc/tests/Makefile
                  src/lib/python/isc/config/Makefile
                  src/lib/python/isc/config/Makefile
+                 src/lib/python/isc/config/tests/Makefile
                  src/lib/config/Makefile
                  src/lib/config/Makefile
                  src/lib/config/tests/Makefile
                  src/lib/config/tests/Makefile
                  src/lib/dns/Makefile
                  src/lib/dns/Makefile
@@ -411,7 +419,7 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
            src/bin/usermgr/run_b10-cmdctl-usermgr.sh
            src/bin/usermgr/run_b10-cmdctl-usermgr.sh
            src/bin/usermgr/b10-cmdctl-usermgr.py
            src/bin/usermgr/b10-cmdctl-usermgr.py
            src/bin/msgq/msgq.py
            src/bin/msgq/msgq.py
-           src/bin/msgq/msgq_test
+           src/bin/msgq/tests/msgq_test
            src/bin/msgq/run_msgq.sh
            src/bin/msgq/run_msgq.sh
            src/bin/auth/auth.spec.pre
            src/bin/auth/auth.spec.pre
            src/bin/auth/spec_config.h
            src/bin/auth/spec_config.h
@@ -433,7 +441,7 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
            chmod +x src/bin/loadzone/run_loadzone.sh
            chmod +x src/bin/loadzone/run_loadzone.sh
            chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
            chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
            chmod +x src/bin/msgq/run_msgq.sh
            chmod +x src/bin/msgq/run_msgq.sh
-           chmod +x src/bin/msgq/msgq_test
+           chmod +x src/bin/msgq/tests/msgq_test
            chmod +x src/lib/dns/gen-rdatacode.py
            chmod +x src/lib/dns/gen-rdatacode.py
            chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
            chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
           ])
           ])

+ 3 - 1
src/bin/bind10/Makefile.am

@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 sbin_SCRIPTS = bind10
 sbin_SCRIPTS = bind10
 CLEANFILES = bind10
 CLEANFILES = bind10
 
 
@@ -8,7 +10,7 @@ bind10_DATA = bob.spec
 EXTRA_DIST = bob.spec
 EXTRA_DIST = bob.spec
 
 
 man_MANS = bind10.8
 man_MANS = bind10.8
-EXTRA_DIST += $(man_MANS) bind10.xml tests/bind10_test.py
+EXTRA_DIST += $(man_MANS) bind10.xml
 
 
 if ENABLE_MAN
 if ENABLE_MAN
 
 

+ 12 - 0
src/bin/bind10/tests/Makefile.am

@@ -0,0 +1,12 @@
+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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_srcdir)/src/bin/bind10 \
+	$(PYCOVERAGE) $$pytest ; \
+	done

+ 2 - 1
src/bin/bindctl/Makefile.am

@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 bin_SCRIPTS = bindctl
 bin_SCRIPTS = bindctl
 man_MANS = bindctl.1
 man_MANS = bindctl.1
 
 
@@ -9,7 +11,6 @@ pythondir = $(pyexecdir)/bindctl
 bindctldir = $(DESTDIR)$(pkgdatadir)
 bindctldir = $(DESTDIR)$(pkgdatadir)
 bindctl_DATA = bindctl.pem
 bindctl_DATA = bindctl.pem
 EXTRA_DIST += bindctl.pem
 EXTRA_DIST += bindctl.pem
-EXTRA_DIST += tests/bindctl_test.py
 
 
 CLEANFILES = bindctl
 CLEANFILES = bindctl
 
 

+ 12 - 0
src/bin/bindctl/tests/Makefile.am

@@ -0,0 +1,12 @@
+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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_srcdir)/src/bin \
+	$(PYCOVERAGE) $$pytest ; \
+	done

+ 2 - 1
src/bin/cmdctl/Makefile.am

@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 
 
 pkglibexec_SCRIPTS = b10-cmdctl
 pkglibexec_SCRIPTS = b10-cmdctl
@@ -16,7 +18,6 @@ b10_cmdctl_DATA += cmdctl.spec
  
  
 EXTRA_DIST = $(CMDCTL_CONFIGURATIONS)
 EXTRA_DIST = $(CMDCTL_CONFIGURATIONS)
 EXTRA_DIST += cmdctl.spec
 EXTRA_DIST += cmdctl.spec
-EXTRA_DIST += tests/cmdctl_test.py
 
 
 CLEANFILES=	b10-cmdctl
 CLEANFILES=	b10-cmdctl
 
 

+ 12 - 0
src/bin/cmdctl/tests/Makefile.am

@@ -0,0 +1,12 @@
+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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_srcdir)/src/bin/cmdctl \
+	$(PYCOVERAGE) $$pytest ; \
+	done

+ 3 - 1
src/bin/msgq/Makefile.am

@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
  
  
 pkglibexec_SCRIPTS = b10-msgq
 pkglibexec_SCRIPTS = b10-msgq
@@ -5,7 +7,7 @@ pkglibexec_SCRIPTS = b10-msgq
 CLEANFILES = msgq
 CLEANFILES = msgq
 
 
 man_MANS = b10-msgq.8
 man_MANS = b10-msgq.8
-EXTRA_DIST = $(man_MANS) msgq.xml msgq_test.py
+EXTRA_DIST = $(man_MANS) msgq.xml
 
 
 if ENABLE_MAN
 if ENABLE_MAN
 
 

+ 13 - 0
src/bin/msgq/tests/Makefile.am

@@ -0,0 +1,13 @@
+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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/bin/msgq:$(abs_top_srcdir)/src/lib/python \
+	$(PYCOVERAGE) $$pytest ; \
+	done
+

+ 2 - 2
src/bin/msgq/msgq_test.in

@@ -18,9 +18,9 @@
 PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@}
 PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@}
 export PYTHON_EXEC
 export PYTHON_EXEC
 
 
-MYPATH_PATH=@abs_top_srcdir@/src/bin/msgq
+MYPATH_PATH=@abs_top_srcdir@/src/bin/msgq/tests
 
 
-PYTHONPATH=@abs_top_srcdir@/src/lib/python
+PYTHONPATH=@abs_top_srcdir@/src/bin/msgq:@abs_top_srcdir@/src/lib/python
 
 
 export PYTHONPATH
 export PYTHONPATH
 
 

src/bin/msgq/msgq_test.py → src/bin/msgq/tests/msgq_test.py


+ 2 - 1
src/bin/xfrin/Makefile.am

@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 
 
 pkglibexec_SCRIPTS = b10-xfrin
 pkglibexec_SCRIPTS = b10-xfrin
@@ -9,7 +11,6 @@ CLEANFILES = b10-xfrin xfrin.spec
 
 
 man_MANS = b10-xfrin.8
 man_MANS = b10-xfrin.8
 EXTRA_DIST = $(man_MANS) b10-xfrin.xml
 EXTRA_DIST = $(man_MANS) b10-xfrin.xml
-EXTRA_DIST += tests/xfrin_test.py
 
 
 if ENABLE_MAN
 if ENABLE_MAN
 
 

+ 16 - 0
src/bin/xfrin/tests/Makefile.am

@@ -0,0 +1,16 @@
+if HAVE_BOOST_PYTHON
+
+PYTESTS = xfrin_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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/lib/dns/.libs:$(abs_top_srcdir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python \
+	$(PYCOVERAGE) $$pytest ; \
+	done
+
+endif

+ 2 - 2
src/bin/xfrout/Makefile.am

@@ -1,3 +1,5 @@
+SUBDIRS = tests
+
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 
 
 pkglibexec_SCRIPTS = b10-xfrout
 pkglibexec_SCRIPTS = b10-xfrout
@@ -7,8 +9,6 @@ b10_xfrout_DATA = xfrout.spec
 
 
 CLEANFILES=	b10-xfrout xfrout.spec
 CLEANFILES=	b10-xfrout xfrout.spec
 
 
-EXTRA_DIST = tests/xfrout_test.py
-
 xfrout.spec: xfrout.spec.pre
 xfrout.spec: xfrout.spec.pre
 	$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" xfrout.spec.pre >$@
 	$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" xfrout.spec.pre >$@
 
 

+ 12 - 0
src/bin/xfrout/tests/Makefile.am

@@ -0,0 +1,12 @@
+PYTESTS = xfrout_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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_srcdir)/src/lib/dns/.libs:$(abs_top_srcdir)/src/lib/xfr/.libs \
+	$(PYCOVERAGE) $$pytest ; \
+	done

+ 2 - 6
src/lib/python/isc/cc/Makefile.am

@@ -1,9 +1,5 @@
+SUBDIRS = tests
+
 python_PYTHON =	__init__.py data.py session.py message.py
 python_PYTHON =	__init__.py data.py session.py message.py
 
 
 pythondir = $(pyexecdir)/isc/cc
 pythondir = $(pyexecdir)/isc/cc
-
-EXTRA_DIST =  tests/data_test.py
-EXTRA_DIST += tests/sendcmd.py
-EXTRA_DIST += tests/session_test.py
-EXTRA_DIST += tests/test.py
-EXTRA_DIST += tests/test_session.py

+ 16 - 0
src/lib/python/isc/cc/tests/Makefile.am

@@ -0,0 +1,16 @@
+#PYTESTS = data_test.py session_test.py test.py
+PYTESTS = 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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/lib/python \
+	$(PYCOVERAGE) $$pytest ; \
+	done

+ 2 - 6
src/lib/python/isc/config/Makefile.am

@@ -1,9 +1,5 @@
+SUBDIRS = tests
+
 python_PYTHON = __init__.py ccsession.py cfgmgr.py config_data.py module_spec.py
 python_PYTHON = __init__.py ccsession.py cfgmgr.py config_data.py module_spec.py
 
 
 pythondir = $(pyexecdir)/isc/config
 pythondir = $(pyexecdir)/isc/config
-
-EXTRA_DIST = tests/ccsession_test.py
-EXTRA_DIST += tests/cfgmgr_test.py
-EXTRA_DIST += tests/config_data_test.py
-EXTRA_DIST += tests/module_spec_test.py
-EXTRA_DIST += tests/unittest_fakesession.py

+ 15 - 0
src/lib/python/isc/config/tests/Makefile.am

@@ -0,0 +1,15 @@
+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:
+	for pytest in $(PYTESTS) ; do \
+	echo Running test: $$pytest ; \
+	env PYTHONPATH=$(abs_top_srcdir)/src/lib/python \
+	CONFIG_TESTDATA_PATH=$(abs_top_srcdir)/src/lib/config/testdata \
+	$(PYCOVERAGE) $$pytest ; \
+	done