diff --git a/Makefile.am b/Makefile.am index ebcf3e7fbe..18b34e7eb4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,11 @@ DISTCHECK_PERFDHCP_CONFIGURE_FLAG=@DISTCHECK_PERFDHCP_CONFIGURE_FLAG@ DISTCHECK_KEA_SHELL_CONFIGURE_FLAG=@DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@ DISTCHECK_PREMIUM_CONFIGURE_FLAG=@DISTCHECK_PREMIUM_CONFIGURE_FLAG@ DISTCHECK_CONTRIB_CONFIGURE_FLAG=@DISTCHECK_CONTRIB_CONFIGURE_FLAG@ +DISTCHECK_MYSQL_CONFIGURE_FLAG=@DISTCHECK_MYSQL_CONFIGURE_FLAG@ +DISTCHECK_PGSQL_CONFIGURE_FLAG=@DISTCHECK_PGSQL_CONFIGURE_FLAG@ +DISTCHECK_GSSAPI_CONFIGURE_FLAG=@DISTCHECK_GSSAPI_CONFIGURE_FLAG@ +DISTCHECK_LIBYANG_CONFIGURE_FLAG=@DISTCHECK_LIBYANG_CONFIGURE_FLAG@ +DISTCHECK_SYSREPO_CONFIGURE_FLAG=@DISTCHECK_SYSREPO_CONFIGURE_FLAG@ OVERALL_COVERAGE_DIR=$(abs_top_builddir)/coverage-cpp-html @@ -47,6 +52,21 @@ DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_PREMIUM_CONFIGURE_FLAG) # Keep the contrib config DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_CONTRIB_CONFIGURE_FLAG) +# Keep the mysql config +DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_MYSQL_CONFIGURE_FLAG) + +# Keep the pgsql config +DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_PGSQL_CONFIGURE_FLAG) + +# Keep the gssapi config +DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_GSSAPI_CONFIGURE_FLAG) + +# Keep the libyang config +DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_LIBYANG_CONFIGURE_FLAG) + +# Keep the sysrepo config +DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_SYSREPO_CONFIGURE_FLAG) + dist_doc_DATA = AUTHORS COPYING ChangeLog README CONTRIBUTING.md platforms.rst code_of_conduct.md .PHONY: check-valgrind check-valgrind-suppress @@ -114,9 +134,10 @@ endif --ignore-errors gcov,source,graph \ --output report.info; \ sed --in-place --expression "s|$(abs_top_srcdir)|$(abs_top_builddir)|g" report.info; \ - "$(GENHTML)" --frames --show-details --title 'Kea code coverage report' --legend \ - --function-coverage --ignore-errors source --demangle-cpp \ - --output "$(OVERALL_COVERAGE_DIR)" report.info; \ + "$(GENHTML)" \ + --frames --show-details --title 'Kea code coverage report' --legend \ + --function-coverage --ignore-errors source --demangle-cpp \ + --output "$(OVERALL_COVERAGE_DIR)" report.info; \ printf "Generated C++ code coverage report in HTML at %s.\n" "$(OVERALL_COVERAGE_DIR)"; \ else \ echo "C++ code coverage not enabled at configuration time." ; \ diff --git a/configure.ac b/configure.ac index 7e02660125..d8605f6378 100644 --- a/configure.ac +++ b/configure.ac @@ -677,11 +677,14 @@ elif test "${mysql_config}" != "no" ; then MYSQL_CONFIG="${withval}" fi +DISTCHECK_MYSQL_CONFIGURE_FLAG= if test "$MYSQL_CONFIG" != "" ; then if test -d "$MYSQL_CONFIG" -o ! -x "$MYSQL_CONFIG" ; then AC_MSG_ERROR([MySQL dependencies cannot be found. Please install MySQL libraries or point --with-mysql to mysql_config program if it is located in non-default directory, eg. --with-mysql=/opt/mysql/bin/mysql_config.]) fi + DISTCHECK_MYSQL_CONFIGURE_FLAG="--with-mysql=$MYSQL_CONFIG" + MYSQL_CPPFLAGS=`$MYSQL_CONFIG --cflags` MYSQL_LIBS=`$MYSQL_CONFIG --libs` MYSQL_LIBS="$MYSQL_LIBS $CRYPTO_LIBS" @@ -689,6 +692,7 @@ if test "$MYSQL_CONFIG" != "" ; then AC_SUBST(MYSQL_CPPFLAGS) AC_SUBST(MYSQL_LIBS) + AC_SUBST(DISTCHECK_MYSQL_CONFIGURE_FLAG) # Check that a simple program using MySQL functions can compile and link. CPPFLAGS_SAVED="$CPPFLAGS" @@ -757,11 +761,14 @@ elif test "${pg_config}" != "no" ; then PG_CONFIG="${withval}" fi +DISTCHECK_PGSQL_CONFIGURE_FLAG= if test "$PG_CONFIG" != "" ; then if test -d "$PG_CONFIG" -o ! -x "$PG_CONFIG" ; then AC_MSG_ERROR([PostgreSQL dependencies cannot be found. Please install PostgreSQL libraries or point --with-pgsql to pg_config program if it is located in non-default directory, eg. --with-pgsql=/opt/pgsql/bin/pg_config.]) fi + DISTCHECK_PGSQL_CONFIGURE_FLAG="--with-pgsql=$PG_CONFIG" + PGSQL_CPPFLAGS=`$PG_CONFIG --cppflags` PGSQL_INCLUDEDIR=`$PG_CONFIG --includedir` PGSQL_INCLUDEDIR_SERVER=`$PG_CONFIG --includedir-server` @@ -772,6 +779,7 @@ if test "$PG_CONFIG" != "" ; then AC_SUBST(PGSQL_CPPFLAGS) AC_SUBST(PGSQL_LIBS) + AC_SUBST(DISTCHECK_PGSQL_CONFIGURE_FLAG) # Check that a simple program using PostgreSQL functions can compile and link. CPPFLAGS_SAVED="$CPPFLAGS" diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am index 7fa957bdcd..bfe15ea002 100644 --- a/doc/sphinx/Makefile.am +++ b/doc/sphinx/Makefile.am @@ -188,7 +188,6 @@ update-python-dependencies: ./src/requirements.in clean-local: rm -rf $(sphinxbuilddir) - rm -f $(srcdir)/mes-files.txt $(srcdir)/api-files.txt rm -f $(srcdir)/kea-messages.rst $(srcdir)/api.rst rm -f $(srcdir)/arm/platforms.rst diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index 534c18e4f7..3325893a62 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -6906,7 +6906,7 @@ All supported parameters can be configured via the ``cb_cmds`` hook library described in the :ref:`hooks-cb-cmds` section. The general rule is that scalar global parameters are set using ``remote-global-parameter4-set``; shared-network-specific parameters -are set using ``remote-network4-set``; and subnet- and pool-level +are set using ``remote-network4-set``; and subnet-level and pool-level parameters are set using ``remote-subnet4-set``. Whenever there is an exception to this general rule, it is highlighted in the table. Non-scalar global parameters have dedicated commands; for example, diff --git a/m4macros/ax_gssapi.m4 b/m4macros/ax_gssapi.m4 index 2360a3755e..539343edad 100644 --- a/m4macros/ax_gssapi.m4 +++ b/m4macros/ax_gssapi.m4 @@ -13,6 +13,7 @@ AC_ARG_WITH([gssapi], ENABLE_GSSAPI=no GSSAPI_CFLAGS= GSSAPI_LIBS= +DISTCHECK_GSSAPI_CONFIGURE_FLAG="--with-gssapi=$gssapi_path" AC_MSG_CHECKING([for gssapi support]) if test "x$gssapi_path" = "x" ; then @@ -86,6 +87,7 @@ fi AC_SUBST(GSSAPI_CFLAGS) AC_SUBST(GSSAPI_LIBS) +AC_SUBST(DISTCHECK_GSSAPI_CONFIGURE_FLAG) AM_CONDITIONAL([HAVE_GSSAPI], [test $ENABLE_GSSAPI = "yes"]) ])dnl AX_GSS_API diff --git a/m4macros/ax_sysrepo.m4 b/m4macros/ax_sysrepo.m4 index 415125e6b2..50b30713c1 100644 --- a/m4macros/ax_sysrepo.m4 +++ b/m4macros/ax_sysrepo.m4 @@ -4,10 +4,14 @@ AC_DEFUN([AX_SYSREPO], [ [AS_HELP_STRING([--with-libyang[[=PATH]]], [optional path to the libyang installation directory])], [with_libyang="${withval}"]) + DISTCHECK_LIBYANG_CONFIGURE_FLAG="--with-libyang=$with_libyang" + AC_ARG_WITH([sysrepo], [AS_HELP_STRING([--with-sysrepo[[=PATH]]], [optional path to the sysrepo installation directory])], [with_sysrepo="${withval}"]) + DISTCHECK_SYSREPO_CONFIGURE_FLAG="--with-sysrepo=$with_sysrepo" + # If --with-libyang was omitted, assume it was passed and give it the value # from --with-sysrepo. if test -z "${with_libyang}"; then @@ -220,4 +224,6 @@ AC_DEFUN([AX_SYSREPO], [ AC_SUBST(SRPD_PLUGINS_PATH) AC_SUBST(SYSREPO_VERSION) AC_SUBST(SYSREPOCPP_VERSION) + AC_SUBST(DISTCHECK_LIBYANG_CONFIGURE_FLAG) + AC_SUBST(DISTCHECK_SYSREPO_CONFIGURE_FLAG) ]) diff --git a/src/bin/admin/tests/data/Makefile.am b/src/bin/admin/tests/data/Makefile.am index 3e9f88dbbb..7ce62898ec 100644 --- a/src/bin/admin/tests/data/Makefile.am +++ b/src/bin/admin/tests/data/Makefile.am @@ -1,3 +1,3 @@ EXTRA_DIST = \ - lease4_dump_test.reference.csv \ - lease6_dump_test.reference.csv + lease4_dump_test.reference.csv \ + lease6_dump_test.reference.csv diff --git a/src/bin/agent/tests/Makefile.am b/src/bin/agent/tests/Makefile.am index 7cfedfeb11..40ac32765c 100644 --- a/src/bin/agent/tests/Makefile.am +++ b/src/bin/agent/tests/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST += testdata/hiddens EXTRA_DIST += testdata/hiddenu TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) # Shell tests SHTESTS = ca_process_tests.sh diff --git a/src/bin/d2/tests/Makefile.am b/src/bin/d2/tests/Makefile.am index 0da992b6ec..b47513278e 100644 --- a/src/bin/d2/tests/Makefile.am +++ b/src/bin/d2/tests/Makefile.am @@ -6,7 +6,7 @@ EXTRA_DIST += testdata/d2_cfg_tests.json EXTRA_DIST += testdata/get_config.json TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) # Shell tests SHTESTS = d2_process_tests.sh diff --git a/src/bin/dhcp4/tests/Makefile.am b/src/bin/dhcp4/tests/Makefile.am index 8e5808bee5..291d29f284 100644 --- a/src/bin/dhcp4/tests/Makefile.am +++ b/src/bin/dhcp4/tests/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = . EXTRA_DIST = get_config_unittest.cc.skel TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) # Shell tests SHTESTS = dhcp4_process_tests.sh diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index e3518f1ad4..78c7166312 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = . EXTRA_DIST = get_config_unittest.cc.skel TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) # Shell tests SHTESTS = dhcp6_process_tests.sh diff --git a/src/bin/keactrl/Makefile.am b/src/bin/keactrl/Makefile.am index e85392d056..ca9f255726 100644 --- a/src/bin/keactrl/Makefile.am +++ b/src/bin/keactrl/Makefile.am @@ -3,8 +3,9 @@ SUBDIRS = . tests # Install keactrl in sbin and the keactrl.conf required by the keactrl # in etc. keactrl will look for its configuration file in the etc folder. sbin_SCRIPTS = keactrl -KEA_CONFIGFILES = kea-dhcp4.conf kea-dhcp6.conf kea-dhcp-ddns.conf \ - kea-ctrl-agent.conf +KEA_CONFIGFILES = \ + kea-dhcp4.conf kea-dhcp6.conf kea-dhcp-ddns.conf kea-ctrl-agent.conf + if HAVE_SYSREPO KEA_CONFIGFILES += kea-netconf.conf endif @@ -13,9 +14,10 @@ CONFIGFILES = keactrl.conf $(KEA_CONFIGFILES) DISTCLEANFILES = keactrl keactrl.conf CLEANFILES = $(KEA_CONFIGFILES) -EXTRA_DIST = keactrl.in keactrl.conf.in kea-dhcp4.conf.pre \ - kea-dhcp6.conf.pre kea-dhcp-ddns.conf.pre \ - kea-ctrl-agent.conf.pre kea-netconf.conf.pre +EXTRA_DIST = \ + keactrl.in keactrl.conf.in kea-dhcp4.conf.pre \ + kea-dhcp6.conf.pre kea-dhcp-ddns.conf.pre \ + kea-ctrl-agent.conf.pre kea-netconf.conf.pre # *.conf files are not really sources used for building other targets, but we need # these files to be generated before make install is called. @@ -24,23 +26,23 @@ BUILT_SOURCES = $(KEA_CONFIGFILES) kea-dhcp4.conf: kea-dhcp4.conf.pre $(top_builddir)/tools/path_replacer.sh \ - $(top_srcdir)/src/bin/keactrl/kea-dhcp4.conf.pre $@ + $(top_srcdir)/src/bin/keactrl/kea-dhcp4.conf.pre $@ kea-dhcp6.conf: kea-dhcp6.conf.pre $(top_builddir)/tools/path_replacer.sh \ - $(top_srcdir)/src/bin/keactrl/kea-dhcp6.conf.pre $@ + $(top_srcdir)/src/bin/keactrl/kea-dhcp6.conf.pre $@ kea-dhcp-ddns.conf: kea-dhcp-ddns.conf.pre $(top_builddir)/tools/path_replacer.sh \ - $(top_srcdir)/src/bin/keactrl/kea-dhcp-ddns.conf.pre $@ + $(top_srcdir)/src/bin/keactrl/kea-dhcp-ddns.conf.pre $@ kea-ctrl-agent.conf: kea-ctrl-agent.conf.pre $(top_builddir)/tools/path_replacer.sh \ - $(top_srcdir)/src/bin/keactrl/kea-ctrl-agent.conf.pre $@ + $(top_srcdir)/src/bin/keactrl/kea-ctrl-agent.conf.pre $@ kea-netconf.conf: kea-netconf.conf.pre $(top_builddir)/tools/path_replacer.sh \ - $(top_srcdir)/src/bin/keactrl/kea-netconf.conf.pre $@ + $(top_srcdir)/src/bin/keactrl/kea-netconf.conf.pre $@ if INSTALL_CONFIGURATIONS diff --git a/src/bin/lfc/tests/Makefile.am b/src/bin/lfc/tests/Makefile.am index 65593436c0..edba11847d 100644 --- a/src/bin/lfc/tests/Makefile.am +++ b/src/bin/lfc/tests/Makefile.am @@ -15,7 +15,7 @@ AM_LDFLAGS = -static endif TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) TESTS = if HAVE_GTEST diff --git a/src/bin/netconf/tests/Makefile.am b/src/bin/netconf/tests/Makefile.am index e25e62a3b7..594472579f 100644 --- a/src/bin/netconf/tests/Makefile.am +++ b/src/bin/netconf/tests/Makefile.am @@ -24,7 +24,7 @@ AM_LDFLAGS = -static endif TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) TESTS = if HAVE_GTEST diff --git a/src/bin/perfdhcp/tests/Makefile.am b/src/bin/perfdhcp/tests/Makefile.am index 72202a8c4f..c62bd70b1f 100644 --- a/src/bin/perfdhcp/tests/Makefile.am +++ b/src/bin/perfdhcp/tests/Makefile.am @@ -17,7 +17,7 @@ CLEANFILES = *.gcno *.gcda CLEANFILES += test1.hex test2.hex test3.hex test4.hex test5.hex TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) TESTS = if HAVE_GTEST diff --git a/src/lib/dhcpsrv/tests/Makefile.am b/src/lib/dhcpsrv/tests/Makefile.am index 804a497a73..8252ebad23 100644 --- a/src/lib/dhcpsrv/tests/Makefile.am +++ b/src/lib/dhcpsrv/tests/Makefile.am @@ -17,7 +17,7 @@ CLEANFILES = *.gcno *.gcda DISTCLEANFILES = test_libraries.h TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) TESTS = if HAVE_GTEST diff --git a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc index 9383db8b63..0b4f839abf 100644 --- a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1073,6 +1074,25 @@ TEST_F(MySqlLeaseMgrTest, leaseStatsQueryAttribution6MultiThreading) { testLeaseStatsQueryAttribution6(); } +/// @brief This test is a basic check for the generic backend test class, +/// rather than any production code check. +TEST_F(MySqlGenericBackendTest, leaseCount) { + + // Create database connection parameter list + DatabaseConnection::ParameterMap params; + params["name"] = "keatest"; + params["user"] = "keatest"; + params["password"] = "keatest"; + + // Create and open the database connection + MySqlConnection conn(params); + conn.openDatabase(); + + // Check that the countRows is working. It's used extensively in other + // tests, so basic check is enough here. + EXPECT_EQ(0, countRows(conn, "lease4")); +} + /// @brief Checks that no exceptions are thrown when inquiring about JSON /// support and prints an informative message. TEST_F(MySqlLeaseMgrTest, isJsonSupported) { diff --git a/src/lib/dhcpsrv/testutils/mysql_generic_backend_unittest.cc b/src/lib/dhcpsrv/testutils/mysql_generic_backend_unittest.cc index ace663e7b7..ac142d0c6f 100644 --- a/src/lib/dhcpsrv/testutils/mysql_generic_backend_unittest.cc +++ b/src/lib/dhcpsrv/testutils/mysql_generic_backend_unittest.cc @@ -6,8 +6,10 @@ #include #include +#include using namespace isc::db; +using namespace isc::db::test; namespace isc { namespace dhcp { @@ -15,6 +17,7 @@ namespace test { MySqlGenericBackendTest::MySqlGenericBackendTest() : GenericBackendTest() { + createMySQLSchema(); } size_t diff --git a/src/lib/dhcpsrv/testutils/pgsql_generic_backend_unittest.cc b/src/lib/dhcpsrv/testutils/pgsql_generic_backend_unittest.cc index 412ff0486e..8d588a1049 100644 --- a/src/lib/dhcpsrv/testutils/pgsql_generic_backend_unittest.cc +++ b/src/lib/dhcpsrv/testutils/pgsql_generic_backend_unittest.cc @@ -6,8 +6,10 @@ #include #include +#include using namespace isc::db; +using namespace isc::db::test; namespace isc { namespace dhcp { @@ -15,6 +17,7 @@ namespace test { PgSqlGenericBackendTest::PgSqlGenericBackendTest() : GenericBackendTest() { + createPgSQLSchema(); } size_t diff --git a/src/lib/hooks/tests/Makefile.am b/src/lib/hooks/tests/Makefile.am index b6fe8b9a8f..c9ea1a1ba1 100644 --- a/src/lib/hooks/tests/Makefile.am +++ b/src/lib/hooks/tests/Makefile.am @@ -38,8 +38,9 @@ if HAVE_GTEST # to unexpected errors. For this reason, the --enable-static-link option is # ignored for unit tests built here. -noinst_LTLIBRARIES = libnvl.la libivl.la libfxl.la libbcl.la liblcl.la \ - liblecl.la libucl.la libfcl.la libpcl.la libacl.la +noinst_LTLIBRARIES = \ + libnvl.la libivl.la libfxl.la libbcl.la liblcl.la \ + liblecl.la libucl.la libfcl.la libpcl.la libacl.la # -rpath /nowhere is a hack to trigger libtool to not create a # convenience archive, resulting in shared modules diff --git a/src/lib/log/interprocess/tests/Makefile.am b/src/lib/log/interprocess/tests/Makefile.am index 5a53327338..a1f8a73113 100644 --- a/src/lib/log/interprocess/tests/Makefile.am +++ b/src/lib/log/interprocess/tests/Makefile.am @@ -15,7 +15,7 @@ endif CLEANFILES = *.gcno *.gcda TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) TESTS = if HAVE_GTEST diff --git a/src/lib/util/tests/Makefile.am b/src/lib/util/tests/Makefile.am index 56aff6a664..fd696504d6 100644 --- a/src/lib/util/tests/Makefile.am +++ b/src/lib/util/tests/Makefile.am @@ -18,7 +18,7 @@ CLEANFILES = *.gcno *.gcda CLEANFILES += *.csv TESTS_ENVIRONMENT = \ - $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) TESTS = if HAVE_GTEST