Location of test kernel drivers in tree?

Garrett Cooper yaneurabeya at gmail.com
Thu Jul 24 01:45:13 UTC 2014

On Wed, Jul 23, 2014 at 6:29 PM, Julio Merino <jmmv at freebsd.org> wrote:
> On Wed, Jul 23, 2014 at 9:20 PM, Garrett Cooper <yaneurabeya at gmail.com> wrote:
>> I was thinking of sys/tests (with associated build machinery under
>> sys/modules/tests) because the kernel and world [*] build vary wildly
>> by design.
> But didn't we decide a while ago that we'd put kernel tests in
> tests/sys/ precisely to avoid the build system "oddities" of the
> kernel?  That's where the few kernel-level tests that we have today
> live...

Correct (and I have more in isilon-atf and there are more at Isilon
that need to be upstreamed :)..).

> Or am I misunderstanding?  Because if you originally said that you'd
> put _only_ the test-related kernel modules in sys/..., then I guess
> that makes sense!

Yup! That's what I was thinking of doing. I was kind of envisioning
the following:

sys/modules/tests/memguard/Makefile - This will be the makefile that
handles compiling the test kernel module(s) (it might need to be
nested a bit if there are multiple modules because I don't remember if
bsd.kmod.mk can build multiple modules from one Makefile)
sys/tests/memguard/ - this will be where the source for the memguard
test module(s) lives
tests/sys/memguard/ - this will be where the memguard test scripts live

This layout does the following:
1. Makes it clear where the test code lives (helps make things more intuitive).
2. Follows the existing model with kernel code (to some degree).
3. Makes it easy to disable/skip the tests with MK_TESTS (ease of

The only catch is that we really need to "grow" some additional
infrastructure around ATF/kyua on FreeBSD to detect when modules are
present/loaded/etc to set that as requirements for tests to avoid
sprinkling bits everywhere in test code to skip tests if the helper
programs or modules aren't present. I already started that to some
degree (I mentioned that in another freebsd-testing thread), but it
needs more work (mostly because what I did works for simple cases but
there are some things I potentially missed dealing with how drivers
are named, etc):
https://github.com/yaneurabeya/freebsd_atf_kyua_test_extensions .
Alan's helped out with an initial pass at reviewing the code.



More information about the freebsd-testing mailing list