tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kernel api testing with atf and rump ?



Hi Antti, tech-kern,

I'm trying to understand how/if it's possible to unit test a self-contained api implementation within kernel source via rump.

For eg: let's say I'm going to write an api with a single function:

int add(int a, int b);

The implementation of this function is in a file, say: src/sys/kern/kern_add.c

It's got the usual kernel header includes:

#include <sys/cdefs.h>
#include <sys/param.h>
....
etc.

and uses some kernel apis like, typically, printf(9), for eg:

What I'd like to be able to do is to test the api add(), in userspace.

From reading: http://www.netbsd.org/docs/rump/ I understand that the glue APIs to userland/posix is provided by rump(3). So, for eg: if I use a kernel api such as printf(9) within  kern_add.c, rump(3) does the magic to translate that to libc's printf(3).

If I'm correct so far ( please point out if I'm not ), then it should be fairly straightforward to use atf to unit test kernel subsystems that are sufficiently isolated. In that context, my questions are:

 - does the default atf source tree contain a generic rump build that provides most/all api translations to userland.
 - is there a quick and dirty way I can test a trivial api such as kern_add.c above.

Any pointers would be great.

Cheers,

--
~Cherry


Home | Main Index | Thread Index | Old Index