BIND 10 master, updated. 8a6f971934a55f86df87c8dc7996d50b2ace0111 [master] Adding timeout tolerance to receiveX() timeout checks.
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Sep 17 17:38:58 UTC 2012
The branch, master has been updated
via 8a6f971934a55f86df87c8dc7996d50b2ace0111 (commit)
from f79bca027235227542cc763f4fbbc45aec365553 (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 8a6f971934a55f86df87c8dc7996d50b2ace0111
Author: Marcin Siodelski <marcin at isc.org>
Date: Mon Sep 17 19:38:35 2012 +0200
[master] Adding timeout tolerance to receiveX() timeout checks.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcp/tests/iface_mgr_unittest.cc | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc
index 8db8706..3bf5ca4 100644
--- a/src/lib/dhcp/tests/iface_mgr_unittest.cc
+++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc
@@ -42,6 +42,13 @@ char LOOPBACK[BUF_SIZE] = "lo";
const uint16_t PORT1 = 10547; // V6 socket
const uint16_t PORT2 = 10548; // V4 socket
+// On some systems measured duration of receive6() and
+// receive4() appears to be shorter than select() timeout.
+// called by these functions. This may be the case
+// if different ime resolutions are used by these functions.
+// For such cases we set the tolerance of 0.01s.
+const uint32_t TIMEOUT_TOLERANCE = 10000;
+
class NakedIfaceMgr: public IfaceMgr {
// "naked" Interface Manager, exposes internal fields
@@ -250,7 +257,8 @@ TEST_F(IfaceMgrTest, receiveTimeout6) {
// precisely reflect the receive timeout. However the
// uncertainity should be low enough to expect that measured
// value is in the range <1.4s; 1.7s>.
- EXPECT_GE(duration.total_microseconds(), 1400000);
+ EXPECT_GE(duration.total_microseconds(),
+ 1400000 - TIMEOUT_TOLERANCE);
EXPECT_LE(duration.total_microseconds(), 1700000);
// Test timeout shorter than 1s.
@@ -260,7 +268,8 @@ TEST_F(IfaceMgrTest, receiveTimeout6) {
ASSERT_FALSE(pkt);
duration = stop_time - start_time;
// Check if measured duration is within <0.5s; 0.8s>.
- EXPECT_GE(duration.total_microseconds(), 500000);
+ EXPECT_GE(duration.total_microseconds(),
+ 500000 - TIMEOUT_TOLERANCE);
EXPECT_LE(duration.total_microseconds(), 800000);
// Test with invalid fractional timeout values.
@@ -300,7 +309,8 @@ TEST_F(IfaceMgrTest, receiveTimeout4) {
// precisely reflect the receive timeout. However the
// uncertainity should be low enough to expect that measured
// value is in the range <2.3s; 2.6s>.
- EXPECT_GE(duration.total_microseconds(), 2300000);
+ EXPECT_GE(duration.total_microseconds(),
+ 2300000 - TIMEOUT_TOLERANCE);
EXPECT_LE(duration.total_microseconds(), 2600000);
// Test timeout shorter than 1s.
@@ -310,7 +320,8 @@ TEST_F(IfaceMgrTest, receiveTimeout4) {
ASSERT_FALSE(pkt);
duration = stop_time - start_time;
// Check if measured duration is within <0.4s; 0.7s>.
- EXPECT_GE(duration.total_microseconds(), 400000);
+ EXPECT_GE(duration.total_microseconds(),
+ 400000 - TIMEOUT_TOLERANCE);
EXPECT_LE(duration.total_microseconds(), 700000);
// Test with invalid fractional timeout values.
More information about the bind10-changes
mailing list