BIND 10 #2264: Pkt4::pack() and Pkt6::pack() should throw an exception on failure

BIND 10 Development do-not-reply at isc.org
Mon Jul 29 15:07:40 UTC 2013


#2264: Pkt4::pack() and Pkt6::pack() should throw an exception on failure
-------------------------------------+-------------------------------------
            Reporter:  stephen       |                        Owner:
                Type:  enhancement   |  UnAssigned
            Priority:  medium        |                       Status:
           Component:  dhcp          |  reviewing
            Keywords:                |                    Milestone:
           Sensitive:  0             |  Sprint-DHCP-20130731
         Sub-Project:  DHCP          |                   Resolution:
Estimated Difficulty:  0             |                 CVSS Scoring:
         Total Hours:  0             |              Defect Severity:
                                     |  Medium
                                     |  Feature Depending on Ticket:
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
Changes (by tmark):

 * owner:   => UnAssigned
 * status:  new => reviewing


Comment:

 Changes made under branch, "trac2264", git commit:
 f395f315a51a23ac058456ec15580231f145bd75

 The patch as received needed some minor corrections.
 1. The unit test code did not compile:
 {{{
 :
 pkt6_unittest.cc: In member function 'virtual
 void<unnamed>::Pkt6Test_packUnpack
 _Test::TestBody()':
 pkt6_unittest.cc:224: error: invalid use of void expression
 pkt6_unittest.cc: In member function 'virtual
 void<unnamed>::Pkt6Test_relayPack_
 Test::TestBody()':
 pkt6_unittest.cc:518: error: invalid use of void expression
 *** Error code 1
 :
 }}}

 The code was still using EXPECT_TRUE macro.  These were replaced with
 EXPECT_NO_THROW.
 Once replace these two tests failed to execute:

 {{{
 [ RUN      ] Pkt6Test.packUnpack
 pkt6_unittest.cc:225: Failure
 Expected: parent->pack() doesn't throw an exception.
   Actual: it throws.
 [  FAILED  ] Pkt6Test.packUnpack (0 ms)
 [ RUN      ] Pkt6Test.addGetDelOptions
 [       OK ] Pkt6Test.addGetDelOptions (0 ms)
 [ RUN      ] Pkt6Test.Timestamp
 [       OK ] Pkt6Test.Timestamp (0 ms)
 [ RUN      ] Pkt6Test.getName
 [       OK ] Pkt6Test.getName (0 ms)
 [ RUN      ] Pkt6Test.relayUnpack
 [       OK ] Pkt6Test.relayUnpack (1 ms)
 [ RUN      ] Pkt6Test.relayPack
 pkt6_unittest.cc:520: Failure
 Expected: parent->pack() doesn't throw an exception.
   Actual: it throws.
 [  FAILED  ] Pkt6Test.relayPack (0 ms)
 [ RUN      ] Pkt6Test.getAnyRelayOption
 [       OK ] Pkt6Test.getAnyRelayOption (0 ms)
 [----------] 9 tests from Pkt6Test (4 ms total)
 }}}

 Closer inspection revealed the Packet6::pack was missing "break"
 statements inside the switch.
 Once corrected, all unit tests passed.

 Beyond that there were some minor line-length and indentation issues (see
 coding guidelines). In all fairness to the patch author, the surrounding
 code isn't exactly compliant either ;).

-- 
Ticket URL: <http://bind10.isc.org/ticket/2264#comment:6>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list