Page MenuHomeFreeBSD

tests/netgraph: Inital framework for testing libnetgraph
ClosedPublic

Authored by donner on Thu, Jun 3, 5:59 PM.

Details

Summary

Provide a framework of functions to test various netgraph modules.
Tests contain:

  • creating, renaming, and destroying nodes
  • connecting and removing hooks
  • sending and receiving data
  • sending ASCII messages
  • errors can be passed for individual inspection or fail the test
  • determine the queue limit for unprocessed packets
Test Plan
$ kyua test
basic:message  ->  passed  [0.005s]
basic:node  ->  passed  [0.113s]
basic:queuelimit  ->  expected_failure: Queue full (320): 1 checks failed as expected; see output for more details  [3.167s]
basic:same_name  ->  passed  [0.005s]
basic:send_recv  ->  passed  [0.057s]
...

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

donner requested review of this revision.Thu, Jun 3, 5:59 PM
donner added a reviewer: tests.
  • Add test for queue limit
donner edited the test plan for this revision. (Show Details)

Minor issue: these tests don't carry the metadata to show they must be run as root, so 'kyua test' fails.

afedorov added inline comments.
tests/sys/netgraph/basic.c
16

Do you have any objection to using the two-clause version of the BSD license?

tests/sys/netgraph/basic.c
16

Any reasoning?

$ fgrep -lR BSD-3-Clause /usr/include/ | wc -l
     445
$ fgrep -lR BSD-2-Clause /usr/include/ | wc -l
     621
In D30629#688115, @kp wrote:

Minor issue: these tests don't carry the metadata to show they must be run as root, so 'kyua test' fails.

Thanks, will add this.

  • Add root requirements to the tests
kp added inline comments.
tests/sys/netgraph/util.c
147

Nit: that { wants to be on the next line.

227

Nit: that { wants to be on the next line.

This revision is now accepted and ready to land.Fri, Jun 4, 11:38 AM