Page MenuHomeFreeBSD

tests/netgraph: Inital framework for testing libnetgraph
ClosedPublic

Authored by donner on Jun 3 2021, 5:59 PM.
Tags
None
Referenced Files
F108429587: D30629.id.diff
Fri, Jan 24, 5:19 PM
Unknown Object (File)
Sat, Jan 18, 12:40 AM
Unknown Object (File)
Sun, Jan 5, 7:24 AM
Unknown Object (File)
Dec 6 2024, 11:13 AM
Unknown Object (File)
Nov 8 2024, 12:57 AM
Unknown Object (File)
Nov 7 2024, 11:55 PM
Unknown Object (File)
Nov 7 2024, 10:08 PM
Unknown Object (File)
Oct 18 2024, 11:01 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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

donner requested review of this revision.Jun 3 2021, 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
17

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

tests/sys/netgraph/basic.c
17

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
148

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

228

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

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