How do I extend Kyua requirements checking for FreeBSD?

Alan Somers asomers at freebsd.org
Thu Jun 26 19:39:57 UTC 2014


On Thu, Jun 26, 2014 at 1:05 PM, Garrett Cooper <yaneurabeya at gmail.com> wrote:
> Hello Julio!
>     I'm looking at extending Kyua to create special FreeBSD-specific
> functionality, and I'm wondering how I should do it. In particular
> there are a couple items that could be checked as prerequisite
> requirements before running tests to avoid running tests:
>     1. Is a service running?
>     2. Is a driver loaded?
>     3. Is a driver loaded as a kernel module or is it statically
> compiled in to the kernel?
>     4. Am I running on a particular filesystem?
>     Etc.
>     If I was to add these "requirements functions" to kyua, how would
> I query the values in an interface agnostic way? I would usually set
> environment variables, but this makes things potentially messier
> (especially in C/C++ unless I create a standalone library to handle
> this)/harder to grep for than having a command which fetches this
> information, like atf-config does for the ATF tester interface.
> Thank you!
> -Garrett

I did it just be creating a library of shell functions that I call
from test bodies.  For example, something like this
function require_module() {
   kldstat $1 || atf_skip "Module $1 is not loaded"
}

But that's not useful for C and C++ tests.  And it would be way cooler
if it were more tightly integrated into Kyua.  Would it be possible to
load site-specific Lua code that would handle this sort of
functionality, so the test could simply say "atf_set require.modules
aio"?

-Alan


More information about the freebsd-testing mailing list