Commit f615602a authored by Francis Dupont's avatar Francis Dupont

[4009] Merge branch 'trac4009' of ssh:// into trac4009

parents 759f0f83 d58342ce
......@@ -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
......@@ -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>
......@@ -28,6 +28,7 @@
#include <boost/scoped_ptr.hpp>
#include <gtest/gtest.h>
#include <fcntl.h>
#include <fstream>
#include <iostream>
#include <sstream>
......@@ -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;
......@@ -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.
// Remove lease files and products of Lease File Cleanup.
......@@ -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_;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment