From: Thomas Markwalder Date: Mon, 9 May 2016 13:19:59 +0000 (-0400) Subject: [master] Fixed unit test compilation post merge X-Git-Tag: trac4106_update_base~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a4792b3551cce2fb9147f33f032ae7e71791d21;p=thirdparty%2Fkea.git [master] Fixed unit test compilation post merge HooksManager::loadLibraries() call now requires LibraryCollection as parameter --- diff --git a/src/bin/dhcp4/tests/hooks_unittest.cc b/src/bin/dhcp4/tests/hooks_unittest.cc index 7a2e0a8843..173274d3ba 100644 --- a/src/bin/dhcp4/tests/hooks_unittest.cc +++ b/src/bin/dhcp4/tests/hooks_unittest.cc @@ -1621,29 +1621,28 @@ TEST_F(LoadUnloadDhcpv4SrvTest, unloadLibaries) { ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE)); ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); - // Load two libraries - std::vector libraries; - libraries.push_back(CALLOUT_LIBRARY_1); - libraries.push_back(CALLOUT_LIBRARY_2); - HooksManager::loadLibraries(libraries); - - // Check they are loaded. - std::vector loaded_libraries = - HooksManager::getLibraryNames(); - ASSERT_TRUE(libraries == loaded_libraries); - - // ... which also included checking that the marker file created by the - // load functions exists and holds the correct value (of "12" - the - // first library appends "1" to the file, the second appends "2"). Also + // Load the test libraries + HookLibsCollection libraries; + libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_1), + ConstElementPtr())); + libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_2), + + ConstElementPtr())); + ASSERT_TRUE(HooksManager::loadLibraries(libraries)); + + // Verify that they load functions created the LOAD_MARKER_FILE + // and that it's contents are correct: "12" - the first library + // appends "1" to the file, the second appends "2"). Also // check that the unload marker file does not yet exist. EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); + // Destroy the server, instance which should unload the libraries. server_.reset(); - // Check that the libraries have unloaded and reloaded. The libraries are - // unloaded in the reverse order to which they are loaded. When they load, - // they should append information to the loading marker file. + // Check that the libraries were unloaded. The libraries are + // unloaded in the reverse order to which they are loaded, and + // this should be reflected in the unload file. EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "21")); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); } diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index 7907174422..ecb987ac8f 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -1661,31 +1661,31 @@ TEST_F(LoadUnloadDhcpv6SrvTest, unloadLibaries) { ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE)); ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); - // Load two libraries - std::vector libraries; - libraries.push_back(CALLOUT_LIBRARY_1); - libraries.push_back(CALLOUT_LIBRARY_2); - HooksManager::loadLibraries(libraries); - - // Check they are loaded. - std::vector loaded_libraries = - HooksManager::getLibraryNames(); - ASSERT_TRUE(libraries == loaded_libraries); - - // ... which also included checking that the marker file created by the - // load functions exists and holds the correct value (of "12" - the - // first library appends "1" to the file, the second appends "2"). Also + // Load the test libraries + HookLibsCollection libraries; + libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_1), + ConstElementPtr())); + libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_2), + + ConstElementPtr())); + ASSERT_TRUE(HooksManager::loadLibraries(libraries)); + + // Verify that they load functions created the LOAD_MARKER_FILE + // and that it's contents are correct: "12" - the first library + // appends "1" to the file, the second appends "2"). Also // check that the unload marker file does not yet exist. EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); + // Destroy the server, instance which should unload the libraries. server_.reset(); - // Check that the libraries have unloaded and reloaded. The libraries are - // unloaded in the reverse order to which they are loaded. When they load, - // they should append information to the loading marker file. + // Check that the libraries were unloaded. The libraries are + // unloaded in the reverse order to which they are loaded, and + // this should be reflected in the unload file. EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "21")); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); + } } // end of anonymous namespace