BIND 10 master, updated. ebb759a07c67f015305019aa34ff20f69218a094 Fix for distcheck and dhcp6 tests on NetBSD

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Dec 14 17:33:03 UTC 2011


The branch, master has been updated
       via  ebb759a07c67f015305019aa34ff20f69218a094 (commit)
      from  b015cf738dc87f33f5f9e3c16bed1f19b1a18fc4 (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 ebb759a07c67f015305019aa34ff20f69218a094
Author: Tomek Mrugalski <tomasz at isc.org>
Date:   Wed Dec 14 18:32:41 2011 +0100

    Fix for distcheck and dhcp6 tests on NetBSD
    
    - Fixed distcheck complaining about file left in src/bin/dhcp4
    - Fixed socket binding problem in src/lib/dhcp/tests/iface_mgr
    - Fixed OSError problem in src/bin/dhcp6/tests/dhcp6_test.py on NetBSD

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

Summary of changes:
 src/bin/dhcp4/Makefile.am                 |    2 ++
 src/bin/dhcp4/tests/dhcp4_srv_unittest.cc |    2 +-
 src/bin/dhcp6/tests/dhcp6_srv_unittest.cc |    6 +++---
 src/bin/dhcp6/tests/dhcp6_test.py         |    8 +++++++-
 src/lib/dhcp/tests/iface_mgr_unittest.cc  |   27 ++++++++++++++++-----------
 5 files changed, 29 insertions(+), 16 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am
index eccbc2d..513ae1c 100644
--- a/src/bin/dhcp4/Makefile.am
+++ b/src/bin/dhcp4/Makefile.am
@@ -12,6 +12,8 @@ endif
 
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 
+CLEANFILES = spec_config.h
+
 man_MANS = b10-dhcp4.8
 EXTRA_DIST = $(man_MANS) dhcp4.spec
 
diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
index c20e983..c1976e1 100644
--- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
+++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
@@ -64,7 +64,7 @@ TEST_F(Dhcpv4SrvTest, basic) {
     // nothing to test. DHCPv4_srv instance is created
     // in test fixture. It is destroyed in destructor
 
-    Dhcpv4Srv* srv = 0;
+    Dhcpv4Srv* srv = NULL;
     ASSERT_NO_THROW({
         srv = new Dhcpv4Srv();
     });
diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
index 50f37af..092dd2e 100644
--- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
+++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
@@ -57,7 +57,7 @@ TEST_F(Dhcpv6SrvTest, basic) {
     // interfaces.txt instead. It will pretend to have detected
     // fe80::1234 link-local address on eth0 interface. Obviously
     // an attempt to bind this socket will fail.
-    Dhcpv6Srv* srv = 0;
+    Dhcpv6Srv* srv = NULL;
     ASSERT_NO_THROW( {
         // open an unpriviledged port
         srv = new Dhcpv6Srv(DHCP6_SERVER_PORT + 10000);
@@ -67,7 +67,7 @@ TEST_F(Dhcpv6SrvTest, basic) {
 }
 
 TEST_F(Dhcpv6SrvTest, Solicit_basic) {
-    NakedDhcpv6Srv * srv = 0;
+    NakedDhcpv6Srv* srv = NULL;
     ASSERT_NO_THROW( srv = new NakedDhcpv6Srv(); );
 
     // a dummy content for client-id
@@ -116,7 +116,7 @@ TEST_F(Dhcpv6SrvTest, Solicit_basic) {
     boost::shared_ptr<Option> tmp = reply->getOption(D6O_IA_NA);
     ASSERT_TRUE( tmp );
 
-    Option6IA * reply_ia = dynamic_cast<Option6IA*> ( tmp.get() );
+    Option6IA* reply_ia = dynamic_cast<Option6IA*> ( tmp.get() );
     EXPECT_EQ( 234, reply_ia->getIAID() );
 
     // check that there's an address included
diff --git a/src/bin/dhcp6/tests/dhcp6_test.py b/src/bin/dhcp6/tests/dhcp6_test.py
index 5ae1f5e..d63e04d 100644
--- a/src/bin/dhcp6/tests/dhcp6_test.py
+++ b/src/bin/dhcp6/tests/dhcp6_test.py
@@ -59,7 +59,13 @@ class TestDhcpv6Daemon(unittest.TestCase):
         # kill this process
         # XXX: b10-dhcp6 is too dumb to understand 'shutdown' command for now,
         #      so let's just kill the bastard
-        os.kill(pi.pid, signal.SIGTERM)
+
+        # TODO: Ignore errors for now. This test will be more thorough once ticket #1503
+        # (passing port number to b10-dhcp6 daemon) is implemented.
+        try:
+            os.kill(pi.pid, signal.SIGTERM)
+        except OSError:
+            print("Ignoring failed kill attempt. Process is dead already.")
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc
index 088f177..b647c18 100644
--- a/src/lib/dhcp/tests/iface_mgr_unittest.cc
+++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc
@@ -101,9 +101,9 @@ TEST_F(IfaceMgrTest, dhcp6Sniffer) {
     interfaces << "eth0 fe80::21e:8cff:fe9b:7349";
     interfaces.close();
 
-    NakedIfaceMgr * ifacemgr = new NakedIfaceMgr();
+    NakedIfaceMgr* ifacemgr = new NakedIfaceMgr();
 
-    Pkt6 * pkt = 0;
+    Pkt6* pkt = NULL;
     int cnt = 0;
     cout << "---8X-----------------------------------------" << endl;
     while (true) {
@@ -155,7 +155,7 @@ TEST_F(IfaceMgrTest, basic) {
 TEST_F(IfaceMgrTest, ifaceClass) {
     // basic tests for Iface inner class
 
-    IfaceMgr::Iface * iface = new IfaceMgr::Iface("eth5", 7);
+    IfaceMgr::Iface* iface = new IfaceMgr::Iface("eth5", 7);
 
     EXPECT_STREQ("eth5/7", iface->getFullName().c_str());
 
@@ -168,7 +168,7 @@ TEST_F(IfaceMgrTest, ifaceClass) {
 TEST_F(IfaceMgrTest, getIface) {
 
     cout << "Interface checks. Please ignore socket binding errors." << endl;
-    NakedIfaceMgr * ifacemgr = new NakedIfaceMgr();
+    NakedIfaceMgr* ifacemgr = new NakedIfaceMgr();
 
     // interface name, ifindex
     IfaceMgr::Iface iface1("lo1", 1);
@@ -192,7 +192,7 @@ TEST_F(IfaceMgrTest, getIface) {
 
 
     // check that interface can be retrieved by ifindex
-    IfaceMgr::Iface * tmp = ifacemgr->getIface(5);
+    IfaceMgr::Iface* tmp = ifacemgr->getIface(5);
     // ASSERT_NE(NULL, tmp); is not supported. hmmmm.
     ASSERT_TRUE( tmp != NULL );
 
@@ -225,11 +225,11 @@ TEST_F(IfaceMgrTest, detectIfaces) {
     // interfaces. Nevertheless, this fake interface should
     // be on list, but if_nametoindex() will fail.
 
-    NakedIfaceMgr * ifacemgr = new NakedIfaceMgr();
+    NakedIfaceMgr* ifacemgr = new NakedIfaceMgr();
 
     ASSERT_TRUE( ifacemgr->getIface("eth0") != NULL );
 
-    IfaceMgr::Iface * eth0 = ifacemgr->getIface("eth0");
+    IfaceMgr::Iface* eth0 = ifacemgr->getIface("eth0");
 
     // there should be one address
     IfaceMgr::AddressCollection addrs = eth0->getAddresses();
@@ -240,6 +240,7 @@ TEST_F(IfaceMgrTest, detectIfaces) {
     EXPECT_STREQ( "fe80::1234", addr.toText().c_str() );
 
     delete ifacemgr;
+    unlink(INTERFACE_FILE);
 }
 
 TEST_F(IfaceMgrTest, sockets6) {
@@ -248,7 +249,7 @@ TEST_F(IfaceMgrTest, sockets6) {
 
     createLoInterfacesTxt();
 
-    NakedIfaceMgr * ifacemgr = new NakedIfaceMgr();
+    NakedIfaceMgr* ifacemgr = new NakedIfaceMgr();
 
     IOAddress loAddr("::1");
 
@@ -272,6 +273,7 @@ TEST_F(IfaceMgrTest, sockets6) {
     close(socket2);
 
     delete ifacemgr;
+    unlink(INTERFACE_FILE);
 }
 
 // TODO: disabled due to other naming on various systems
@@ -280,7 +282,7 @@ TEST_F(IfaceMgrTest, DISABLED_sockets6Mcast) {
     // testing socket operation in a portable way is tricky
     // without interface detection implemented
 
-    NakedIfaceMgr * ifacemgr = new NakedIfaceMgr();
+    NakedIfaceMgr* ifacemgr = new NakedIfaceMgr();
 
     IOAddress loAddr("::1");
     IOAddress mcastAddr("ff02::1:2");
@@ -358,6 +360,7 @@ TEST_F(IfaceMgrTest, sendReceive6) {
     EXPECT_TRUE( (rcvPkt->remote_port_ == 10546) || (rcvPkt->remote_port_ == 10547) );
 
     delete ifacemgr;
+    unlink(INTERFACE_FILE);
 }
 
 TEST_F(IfaceMgrTest, socket4) {
@@ -385,11 +388,12 @@ TEST_F(IfaceMgrTest, socket4) {
     close(socket1);
 
     delete ifacemgr;
+    unlink(INTERFACE_FILE);
 }
 
 // Test the Iface structure itself
 TEST_F(IfaceMgrTest, iface) {
-    IfaceMgr::Iface* iface = 0;
+    IfaceMgr::Iface* iface = NULL;
     EXPECT_NO_THROW(
         iface = new IfaceMgr::Iface("eth0",1);
     );
@@ -446,7 +450,7 @@ TEST_F(IfaceMgrTest, socketInfo) {
 
     // now let's test if IfaceMgr handles socket info properly
     createLoInterfacesTxt();
-    NakedIfaceMgr * ifacemgr = new NakedIfaceMgr();
+    NakedIfaceMgr* ifacemgr = new NakedIfaceMgr();
     IfaceMgr::Iface* loopback = ifacemgr->getIface(LOOPBACK);
     ASSERT_TRUE(loopback);
     loopback->addSocket(sock1);
@@ -514,6 +518,7 @@ TEST_F(IfaceMgrTest, socketInfo) {
     );
 
     delete ifacemgr;
+    unlink(INTERFACE_FILE);
 }
 
 }




More information about the bind10-changes mailing list