From: Tomek Mrugalski Date: Fri, 19 Jun 2015 16:40:35 +0000 (+0200) Subject: [master] Compilation fix, a mother of all fixes: X-Git-Tag: trac3910_base~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93a00b82e42211e306e8bb721c286d978253e511;p=thirdparty%2Fkea.git [master] Compilation fix, a mother of all fixes: - linker failure in lfc (and tests), added libkea-cc - linker failure in dhcp6 (and tests), added libkea-stats - remove troublesome CtrlDhcpv4SrvTest.DISABLED_commandSocketBasic test --- diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index c766a540e6..29efa37353 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -260,91 +260,4 @@ TEST_F(CtrlDhcpv4SrvTest, commandsRegistration) { EXPECT_EQ("[ \"list-commands\" ]", answer->get("arguments")->str()); } -// Checks if the server is able to parse control socket configuration and -// configures the command socket properly. - -/// @todo: This unit-test is disabled, because it causes weird issues, when -/// IfaceMgr::receive4() is called in a separate process. That's a side effect -/// of how we run the test. We should either investigate why IfaceMgr doesn't -/// work correctly after fork or develop a small tool that will send data -/// from stdin to specified UNIX socket, print out the responses on stdout -/// and develop shell tests for this. -/// -/// Note that the test passes when run on its own, but not when run along with -/// other unit-tests. -TEST_F(CtrlDhcpv4SrvTest, DISABLED_commandSocketBasic) { - - string socket_path = string(TEST_DATA_BUILDDIR) + "/kea4.sock"; - ::remove(socket_path.c_str()); - - // Just a simple config. The important part here is the socket - // location information. - std::string config_txt = - "{" - " \"interfaces-config\": {" - " \"interfaces\": [ \"*\" ]" - " }," - " \"rebind-timer\": 2000, " - " \"renew-timer\": 1000, " - " \"subnet4\": [ ]," - " \"valid-lifetime\": 4000," - " \"control-socket\": {" - " \"socket-type\": \"unix\"," - " \"socket-name\": \"" + socket_path + "\"" - " }," - " \"lease-database\": { \"type\": \"memfile\", \"persist\": false }" - "}"; - - pid_t pid = fork(); - if (pid > 0) { - cout << "Created child process: " << pid << endl; - - string command("{ \"command\": \"shutdown\" }"); - string response; - - sleep(3); - - EXPECT_TRUE(sendCommandUnixSocket(command, response, socket_path)); - - kill(pid, SIGTERM); - int status; - waitpid(pid, &status, 0); - - ASSERT_NE(0, response.length()); - - ConstElementPtr rsp; - EXPECT_NO_THROW(rsp = Element::fromJSON(response)); - ASSERT_TRUE(rsp); - - int status_code; - ConstElementPtr comment = parseAnswer(status_code, rsp); - EXPECT_EQ(0, status_code); - } else { - - IfaceMgr::instance().deleteAllExternalSockets(); - - boost::scoped_ptr srv; - ASSERT_NO_THROW( - srv.reset(new ControlledDhcpv4Srv(0)); - ); - - ConstElementPtr config = Element::fromJSON(config_txt); - - ConstElementPtr answer = srv->processConfig(config); - ASSERT_TRUE(answer); - - int status = 0; - isc::config::parseAnswer(status, answer); - EXPECT_EQ(0, status); - - // Now check that the socket was indeed open. - ASSERT_TRUE(isc::config::CommandMgr::instance().getControlSocketFD() > -1); - - cout << "Child process: pid=" << pid << ", running server." << endl; - srv->run(); - - exit(EXIT_SUCCESS); - } -} - } // End of anonymous namespace diff --git a/src/bin/dhcp6/Makefile.am b/src/bin/dhcp6/Makefile.am index a899787db7..5140dfa152 100644 --- a/src/bin/dhcp6/Makefile.am +++ b/src/bin/dhcp6/Makefile.am @@ -80,6 +80,7 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la kea_dhcp6_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la +kea_dhcp6_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la kea_dhcp6dir = $(pkgdatadir) kea_dhcp6_DATA = dhcp6.spec diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index 07b94d8117..b4157c72e1 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -111,6 +111,8 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la dhcp6_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la +dhcp6_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la + endif noinst_PROGRAMS = $(TESTS) diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index 693605028f..ad5ba54a27 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -64,6 +64,7 @@ kea_lfc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la kea_lfc_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_lfcdir = $(pkgdatadir) diff --git a/src/bin/lfc/tests/Makefile.am b/src/bin/lfc/tests/Makefile.am index 5b14846ea1..11bfd3277a 100644 --- a/src/bin/lfc/tests/Makefile.am +++ b/src/bin/lfc/tests/Makefile.am @@ -57,6 +57,7 @@ lfc_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la lfc_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la lfc_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la endif