Parcourir la source

[4009] Merge branch 'trac4009' of ssh://git.kea.isc.org/git/kea into trac4009

Francis Dupont il y a 9 ans
Parent
commit
f615602af9

+ 2 - 2
src/bin/d2/tests/d_controller_unittests.cc

@@ -242,9 +242,9 @@ TEST_F(DStubControllerTest, launchRuntimeError) {
     isc::asiolink::IntervalTimer timer(*getIOService());
     timer.setup(genFatalErrorCallback, 2000);
 
-    // Write the valid, empty, config and then run launch() for 1000 ms
+    // Write the valid, empty, config and then run launch() for 5000 ms
     time_duration elapsed_time;
-    EXPECT_THROW(runWithConfig("{}", 2000, elapsed_time), ProcessRunError);
+    EXPECT_THROW(runWithConfig("{}", 5000, elapsed_time), ProcessRunError);
 
     // Verify that duration of the run invocation is the same as the
     // timer duration.  This demonstrates that the shutdown was driven

+ 1 - 2
src/lib/dhcp/duid.h

@@ -16,9 +16,8 @@
 #define DUID_H
 
 #include <asiolink/io_address.h>
-
+#include <boost/shared_ptr.hpp>
 #include <vector>
-
 #include <stdint.h>
 #include <unistd.h>
 

+ 1 - 0
src/lib/dhcp/tests/iface_mgr_unittest.cc

@@ -28,6 +28,7 @@
 #include <boost/scoped_ptr.hpp>
 #include <gtest/gtest.h>
 
+#include <fcntl.h>
 #include <fstream>
 #include <iostream>
 #include <sstream>

+ 1 - 0
src/lib/dhcp/tests/pkt_filter_unittest.cc

@@ -17,6 +17,7 @@
 #include <dhcp/iface_mgr.h>
 #include <dhcp/tests/pkt_filter_test_utils.h>
 #include <gtest/gtest.h>
+#include <fcntl.h>
 
 using namespace isc::asiolink;
 using namespace isc::dhcp;

+ 18 - 3
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc

@@ -134,6 +134,21 @@ public:
     ///
     /// destroys lease manager backend.
     virtual ~MemfileLeaseMgrTest() {
+        // Explicitly destroy the timer and the IO service. Note that they
+        // must be destroyed in this order because test_timer_ depends on
+        // the io_service_ as it is passed its reference during the
+        // construction. It usually doesn't matter unless the timer is
+        // running (hasn't been cancelled). Destroying an underlying
+        // IO service before cancelling the timer relying on it may lead
+        // to a crash. This has been proven on CentOS 6, running boost
+        // version 1.41. Note that destroying the timer also cancels it.
+        // In theory, we could avoid this explicit release of these objects
+        // and rely on the order in which they are declared in the class.
+        // But, this seems to be better as it makes it more visible
+        // what we are doing here.
+        test_timer_.reset();
+        io_service_.reset();
+
         LeaseMgrFactory::destroy();
         // Remove lease files and products of Lease File Cleanup.
         removeFiles(getLeaseFilePath("leasefile4_0.csv"));
@@ -243,12 +258,12 @@ public:
     /// @brief Object providing access to v6 lease IO.
     LeaseFileIO io6_;
 
-    /// @brief Test timer for the test.
-    boost::shared_ptr<IntervalTimer> test_timer_;
-
     /// @brief IO service object used for the timer tests.
     asiolink::IOServicePtr io_service_;
 
+    /// @brief Test timer for the test.
+    boost::shared_ptr<IntervalTimer> test_timer_;
+
     /// @brief Indicates if the @c testTimerCallback should cause test failure.
     bool fail_on_callback_;