Commit 93a00b82 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[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
parent 8c518357
......@@ -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<ControlledDhcpv4Srv> 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
......@@ -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
......@@ -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)
......@@ -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)
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment