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
F158568936: D56372.diff
Wed, Jun 3, 9:13 AM
F158541938: D56372.id175406.diff
Tue, Jun 2, 10:33 PM
Unknown Object (File)
Wed, May 27, 10:51 PM
Unknown Object (File)
Wed, May 27, 10:41 PM
Unknown Object (File)
Tue, May 26, 10:49 PM
Unknown Object (File)
Mon, May 25, 6:22 PM
Unknown Object (File)
Mon, May 25, 6:13 PM
Unknown Object (File)
Fri, May 22, 6:58 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 Passed
Unit
No Test Coverage
Build Status
Buildable 72170
Build 69053: arc lint + arc unit

Event Timeline

kib added inline comments.
tests/sys/kqueue/kqueue_fork.c
116
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
116

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
116

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.

273

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

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

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