BIND 10 trac2231, updated. b7598c1bf13043ba397c898849567ada04bbee9b [2231] Corrected validation ranges for timeouts.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Sep 13 12:25:51 UTC 2012


The branch, trac2231 has been updated
       via  b7598c1bf13043ba397c898849567ada04bbee9b (commit)
      from  250da3f615ed6d09380dc2de7e6633017530bffd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b7598c1bf13043ba397c898849567ada04bbee9b
Author: Marcin Siodelski <marcin at isc.org>
Date:   Thu Sep 13 14:25:42 2012 +0200

    [2231] Corrected validation ranges for timeouts.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dhcp/tests/iface_mgr_unittest.cc |   42 ++++++++++--------------------
 1 file changed, 14 insertions(+), 28 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc
index adcba31..02dca32 100644
--- a/src/lib/dhcp/tests/iface_mgr_unittest.cc
+++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc
@@ -233,31 +233,24 @@ TEST_F(IfaceMgrTest, receiveTimeout6) {
     // Socket is open if its descriptor is greater than zero.
     ASSERT_GT(socket1, 0);
 
-    // Time when call to IfaceMgr::receive6() started.
-    ptime start_time;
-    // Time when call to IfaceMgr::receive6() ended.
-    ptime stop_time;
-    // Time duration between start_time and stop_time.
-    time_duration duration;
-
     // Remember when we call receive6().
-    start_time = microsec_clock::universal_time();
+    ptime start_time = microsec_clock::universal_time();
     // Call receive with timeout of 1s + 400000us = 1.4s.
     Pkt6Ptr pkt;
     ASSERT_NO_THROW(pkt = ifacemgr->receive6(1, 400000));
     // Remember when call to receive6() ended.
-    stop_time = microsec_clock::universal_time();
+    ptime stop_time = microsec_clock::universal_time();
     // We did not send a packet to lo interface so we expect that
     // nothing has been received and timeout has been reached.
     ASSERT_FALSE(pkt);
     // Calculate duration of call to receive6().
-    duration = stop_time - start_time;
+    time_duration duration = stop_time - start_time;
     // We stop the clock when the call completes so it does not
     // precisely reflect the receive timeout. However the
     // uncertainity should be low enough to expect that measured
-    // value is in the range <1.4; 2).
+    // value is in the range <1.4s; 1.7s>.
     EXPECT_GE(duration.total_microseconds(), 1400000);
-    EXPECT_LT(duration.total_seconds(), 2);
+    EXPECT_LE(duration.total_microseconds(), 1700000);
 
     // Test timeout shorter than 1s.
     start_time = microsec_clock::universal_time();
@@ -265,9 +258,9 @@ TEST_F(IfaceMgrTest, receiveTimeout6) {
     stop_time = microsec_clock::universal_time();
     ASSERT_FALSE(pkt);
     duration = stop_time - start_time;
-    // Check if measured duration is within <0.5s; 1s).
+    // Check if measured duration is within <0.5s; 0.8s>.
     EXPECT_GE(duration.total_microseconds(), 500000);
-    EXPECT_LT(duration.total_seconds(), 1);
+    EXPECT_LE(duration.total_microseconds(), 800000);
 
     // Test with invalid fractional timeout values.
     EXPECT_THROW(ifacemgr->receive6(0, 1000000), isc::BadValue);
@@ -290,31 +283,24 @@ TEST_F(IfaceMgrTest, receiveTimeout4) {
     // Socket is open if its descriptor is greater than zero.
     ASSERT_GT(socket1, 0);
 
-    // Time when call to IfaceMgr::receive4() started.
-    ptime start_time;
-    // Time when call to IfaceMgr::receive4() ended.
-    ptime stop_time;
-    // Time duration between start_time and stop_time.
-    time_duration duration;
-
     Pkt4Ptr pkt;
     // Remember when we call receive4().
-    start_time = microsec_clock::universal_time();
+    ptime start_time = microsec_clock::universal_time();
     // Call receive with timeout of 2s + 300000us = 2.3s.
     ASSERT_NO_THROW(pkt = ifacemgr->receive4(2, 300000));
     // Remember when call to receive4() ended.
-    stop_time = microsec_clock::universal_time();
+    ptime stop_time = microsec_clock::universal_time();
     // We did not send a packet to lo interface so we expect that
     // nothing has been received and timeout has been reached.
     ASSERT_FALSE(pkt);
     // Calculate duration of call to receive4().
-    duration = stop_time - start_time;
+    time_duration duration = stop_time - start_time;
     // We stop the clock when the call completes so it does not
     // precisely reflect the receive timeout. However the
     // uncertainity should be low enough to expect that measured
-    // value is in the range <2.3s; 3s).
+    // value is in the range <2.3s; 2.6s>.
     EXPECT_GE(duration.total_microseconds(), 2300000);
-    EXPECT_LT(duration.total_seconds(), 3);
+    EXPECT_LE(duration.total_microseconds(), 2600000);
 
     // Test timeout shorter than 1s.
     start_time = microsec_clock::universal_time();
@@ -322,9 +308,9 @@ TEST_F(IfaceMgrTest, receiveTimeout4) {
     stop_time = microsec_clock::universal_time();
     ASSERT_FALSE(pkt);
     duration = stop_time - start_time;
-    // Check if measured duration is within <0.4s; 1s).
+    // Check if measured duration is within <0.4s; 0.7s>.
     EXPECT_GE(duration.total_microseconds(), 400000);
-    EXPECT_LT(duration.total_seconds(), 1);
+    EXPECT_LE(duration.total_microseconds(), 700000);
 
     // Test with invalid fractional timeout values.
     EXPECT_THROW(ifacemgr->receive6(0, 1000000), isc::BadValue);



More information about the bind10-changes mailing list