Makefile.am 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. PYCOVERAGE_RUN = @PYCOVERAGE_RUN@
  2. PYTESTS = dhcp4_test.py
  3. SHTESTS =
  4. # The test of dynamic reconfiguration based on signals will work only
  5. # if we are using file based configuration approach.
  6. if CONFIG_BACKEND_JSON
  7. SHTESTS += dhcp4_reconfigure_test.sh
  8. SHTESTS += dhcp4_sigterm_test.sh
  9. SHTESTS += dhcp4_sigint_test.sh
  10. endif
  11. EXTRA_DIST = $(PYTESTS)
  12. EXTRA_DIST += dhcp4_reconfigure_test.sh
  13. EXTRA_DIST += dhcp4_sigterm_test.sh
  14. EXTRA_DIST += dhcp4_sigint_test.sh
  15. EXTRA_DIST += dhcp4_shutdown_test.sh
  16. # Explicitly specify paths to dynamic libraries required by loadable python
  17. # modules. That is required on Mac OS systems. Otherwise we will get exception
  18. # about python not being able to load liblog library.
  19. LIBRARY_PATH_PLACEHOLDER =
  20. if SET_ENV_LIBRARY_PATH
  21. LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/cryptolink/.libs:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/cc/.libs:$(abs_top_builddir)/src/lib/config/.libs:$(abs_top_builddir)/src/lib/log/.libs:$(abs_top_builddir)/src/lib/util/.libs:$(abs_top_builddir)/src/lib/util/threads/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/util/io/.libs:$(abs_top_builddir)/src/lib/datasrc/.libs:$$$(ENV_LIBRARY_PATH)
  22. endif
  23. # test using command-line arguments, so use check-local target instead of TESTS
  24. check-local:
  25. for pytest in $(PYTESTS) ; do \
  26. echo Running test: $$pytest ; \
  27. PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_srcdir)/src/bin:$(abs_top_builddir)/src/bin/bind10:$(abs_top_builddir)/src/lib/util/io/.libs \
  28. B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir) \
  29. $(LIBRARY_PATH_PLACEHOLDER) \
  30. $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \
  31. done
  32. for shtest in $(SHTESTS) ; do \
  33. echo Running test: $$shtest ; \
  34. export B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir); \
  35. $(abs_srcdir)/$$shtest || exit ; \
  36. done
  37. AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
  38. AM_CPPFLAGS += -I$(top_builddir)/src/bin # for generated spec_config.h header
  39. AM_CPPFLAGS += -I$(top_srcdir)/src/bin
  40. AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
  41. AM_CPPFLAGS += -I$(top_srcdir)/src/lib/asiolink
  42. AM_CPPFLAGS += $(BOOST_INCLUDES)
  43. AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(abs_top_srcdir)/src/lib/testutils/testdata\"
  44. AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/dhcp6/tests\"
  45. AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
  46. CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
  47. CLEANFILES += $(builddir)/load_marker.txt $(builddir)/unload_marker.txt
  48. CLEANFILES += *.json *.log
  49. AM_CXXFLAGS = $(B10_CXXFLAGS)
  50. if USE_CLANGPP
  51. # Disable unused parameter warning caused by some Boost headers when compiling with clang
  52. AM_CXXFLAGS += -Wno-unused-parameter
  53. endif
  54. TESTS_ENVIRONMENT = \
  55. $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
  56. TESTS =
  57. if HAVE_GTEST
  58. # Build shared libraries for testing. The libtool way to create a shared library
  59. # is to specify "-avoid-version -export-dynamic -module" in the library LDFLAGS
  60. # (see http://www.gnu.org/software/libtool/manual/html_node/Link-mode.html).
  61. # Use of these switches will guarantee that the .so files are created in the
  62. # .libs folder and they can be dlopened.
  63. # Note that the shared libraries with callouts should not be used together with
  64. # the --enable-static-link option. With this option, the bind10 libraries are
  65. # statically linked with the program and if the callout invokes the methods
  66. # which belong to these libraries, the library with the callout will get its
  67. # own copy of the static objects (e.g. logger, ServerHooks) and that will lead
  68. # to unexpected errors. For this reason, the --enable-static-link option is
  69. # ignored for unit tests built here.
  70. noinst_LTLIBRARIES = libco1.la libco2.la
  71. # -rpath /nowhere is a hack to trigger libtool to not create a
  72. # convenience archive, resulting in shared modules
  73. libco1_la_SOURCES = callout_library_1.cc callout_library_common.h
  74. libco1_la_CXXFLAGS = $(AM_CXXFLAGS)
  75. libco1_la_CPPFLAGS = $(AM_CPPFLAGS)
  76. libco1_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  77. libco2_la_SOURCES = callout_library_2.cc callout_library_common.h
  78. libco2_la_CXXFLAGS = $(AM_CXXFLAGS)
  79. libco2_la_CPPFLAGS = $(AM_CPPFLAGS)
  80. libco2_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
  81. TESTS += dhcp4_unittests
  82. dhcp4_unittests_SOURCES = ../dhcp4_srv.h ../dhcp4_srv.cc ../ctrl_dhcp4_srv.cc
  83. dhcp4_unittests_SOURCES += ../dhcp4_log.h ../dhcp4_log.cc
  84. dhcp4_unittests_SOURCES += ../json_config_parser.cc ../json_config_parser.h
  85. dhcp4_unittests_SOURCES += d2_unittest.h d2_unittest.cc
  86. dhcp4_unittests_SOURCES += dhcp4_test_utils.h
  87. dhcp4_unittests_SOURCES += dhcp4_unittests.cc
  88. dhcp4_unittests_SOURCES += dhcp4_srv_unittest.cc
  89. dhcp4_unittests_SOURCES += dhcp4_test_utils.cc dhcp4_test_utils.h
  90. dhcp4_unittests_SOURCES += direct_client_unittest.cc
  91. dhcp4_unittests_SOURCES += wireshark.cc
  92. dhcp4_unittests_SOURCES += ctrl_dhcp4_srv_unittest.cc
  93. dhcp4_unittests_SOURCES += config_parser_unittest.cc
  94. dhcp4_unittests_SOURCES += fqdn_unittest.cc
  95. dhcp4_unittests_SOURCES += marker_file.cc
  96. if CONFIG_BACKEND_BUNDY
  97. # For Bundy backend, we only need to run the usual tests. There are no
  98. # Bundy-specific tests yet.
  99. dhcp4_unittests_SOURCES += ../bundy_controller.cc
  100. dhcp4_unittests_SOURCES += bundy_controller_unittest.cc
  101. endif
  102. if CONFIG_BACKEND_JSON
  103. dhcp4_unittests_SOURCES += ../kea_controller.cc
  104. dhcp4_unittests_SOURCES += kea_controller_unittest.cc
  105. endif
  106. nodist_dhcp4_unittests_SOURCES = ../dhcp4_messages.h ../dhcp4_messages.cc
  107. nodist_dhcp4_unittests_SOURCES += marker_file.h test_libraries.h
  108. dhcp4_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
  109. dhcp4_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
  110. dhcp4_unittests_LDADD = $(GTEST_LDADD)
  111. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
  112. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
  113. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
  114. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
  115. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
  116. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
  117. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
  118. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
  119. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
  120. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
  121. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
  122. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
  123. dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
  124. endif
  125. noinst_EXTRA_DIST = configs-list.txt
  126. noinst_PROGRAMS = $(TESTS)