Page MenuHomeFreeBSD

Expose <sys/types.h> kernel decls to sysunit tests
AbandonedPublic

Authored by rstone on Jan 25 2022, 9:36 PM.

Details

Reviewers
vangyzen
imp
Summary

In order to write unit tests for kernel code, unit tests require
access to certain kernel declarations in our header files. They
can't just get them by defining _KERNEL as that causes unwanted
behaviour for userland code (for example, <sys/errno.h> will not
define errno if _KERNEL is defined).

Add a new macro that unit tests can define to request that
kernel declarations be exposed. Support for this define
can be faulted in to additional headers as unit tests are written
and require access to particular declarations.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 44090
Build 40978: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Jan 25 2022, 9:58 PM

glebius@ has requested a different approach where unit tests define _KERNEL and opt out of the KPI symbols that they don't want, rather than opting into the symbols that they do want.