Page MenuHomeFreeBSD

tests: kqueue: improve diagnostics for our CPONFORK test
AcceptedPublic

Authored by kevans on Mon, Apr 13, 4:40 AM.
Tags
None
Referenced Files
F152478572: D56372.diff
Wed, Apr 15, 5:21 AM
Unknown Object (File)
Mon, Apr 13, 5:02 AM
Subscribers

Details

Reviewers
kib
markj
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.Mon, Apr 13, 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.