Page MenuHomeFreeBSD

tests: kqueue: improve diagnostics for our CPONFORK test
ClosedPublic

Authored by kevans on Apr 13 2026, 4:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 11, 11:54 PM
Unknown Object (File)
Sat, May 9, 10:00 AM
Unknown Object (File)
Tue, May 5, 1:31 PM
Unknown Object (File)
Tue, Apr 28, 8:46 PM
Unknown Object (File)
Mon, Apr 27, 9:17 AM
Unknown Object (File)
Sun, Apr 26, 9:03 AM
Unknown Object (File)
Thu, Apr 23, 7:44 PM
Unknown Object (File)
Thu, Apr 23, 4:54 AM
Subscribers

Details

Summary

Notably, confirm in the child that our close-on-fork fd is actually
closed, and break RECV_ALL out into a table and check each bit
individually to provide a better message when the test fails.

While we're here, just switch to waitid() rather than trying to identify
the point where we have to make the switch. This reduces maintenance
slightly, as keeping our assertion static would require still adding to
a _RECV_ALL mask *just* for that purpose.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
tests/sys/kqueue/kqueue_fork.c
99
This revision is now accepted and ready to land.Apr 13 2026, 10:34 AM
kevans added inline comments.
tests/sys/kqueue/kqueue_fork.c
99

Fitting within single 80 columns, maybe: expect = childmask && rcv->recv_parent_only ? 0 : rcv->recv_bit; -> I note that childmask and recv_parent_only are both actually bool, so should be fine? I mainly hadn't ternary'd it initially because I hate the aesthetics when they have to wrap, but maybe not so bad.

tests/sys/kqueue/kqueue_fork.c
99

I prefer ternary op becase

  1. it avoids repeating assignment to the same variable
  2. it puts more code on the same sized screen or emacs window
markj added inline comments.
tests/sys/kqueue/kqueue_fork.c
58

I would keep this closer to the actual definition of the test. I know our style guide wants global variables defined first but for tests that makes less sense IMO.

269

This doesn't need to be WEXITSTATUS(info.si_status)?

kevans added inline comments.
tests/sys/kqueue/kqueue_fork.c
269

With siginfo, si_status preserves the exit status faithfully because the reason is stored out of band in si_codeinstead.