tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kernel api testing with atf and rump ?
"Cherry G. Mathew" <cherry.g.mathew%gmail.com@localhost> wrote:
> 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);
>
> ...
>
> Any pointers would be great.
It seems to me that there are two ways one can use RUMP: a client-server
model (where system calls are passed to the RUMP hypervisor kernel) or raw
calls to the kernel-space functions. I cannot tell much about the former.
The latter is better (at least for me) for unit tests. Here is an example
of NPF unit tests:
http://nxr.netbsd.org/xref/src/usr.sbin/npf/npftest/
Kernel namespace code has to be in a separate object file (we do it via
private library, see the Makefile magic):
http://nxr.netbsd.org/xref/src/usr.sbin/npf/npftest/libnpftest/
Kernel namespace is prefixed with rumpns_. Symbols in the object/library
are renamed by the RUMP framework. In your example, the call from the
frontend of application (user namespace part) would be to rumpns_add().
Note that we already have shared libraries for kernel subsystems, which
can be just linked (e.g. librumpnet, librumpvfs, etc):
http://nxr.netbsd.org/xref/src/sys/rump/
For example, NPF itself is provided by librumpdev_npf:
http://nxr.netbsd.org/xref/src/sys/rump/dev/lib/libnpf/
So, you have the following (kernel namespace is in curly brackets and
already built and provided kernel components in square brackets):
npftest -> { libnpftest -> [ librumpdev_npf + librumpnet_net + ... ] }
It is something what "works for me". If intended way of RUMP framework
use was different, I hope Antti will point that out.
--
Mindaugas
Home |
Main Index |
Thread Index |
Old Index