Re: [RFC] Regression testing framework for the kernel



On Mon, May 11, 2009 at 05:44:12AM -0400, Christoph Hellwig wrote:
On Thu, Apr 30, 2009 at 11:05:56PM +0200, Jack Stone wrote:
Hi All,

I would like to suggest a new framework to test the kernel. This
framework would have the following goals:
* Only runs at build time and has no effect on running kernel

I don't think we should ever run tests at build time unconditionally.
If we want to integrate it with make it should at least be a separate
make check.

Sorry I should have said explicitly, that was my intention.

The best way of acheiving this that I have thought of it to compile the
kernel source in question and
to link it with special framework files. These files would serve two
purposes: to provide the main function
of the program and to provide the missing symbols for the kernel code.
This would allow the replacement of
certain functions in the code. For example replacing the spin_lock and
spin_unlock functions would allow the
locking behavior to be checked.

That's going to be a lot of stubs if we want to have a wide coverage.
Then again people are alredy doing this in various places, either with
the code in-tree but not easily buildable or out of tree, so having
all this in a common place and a common test driver would be a defintive
improvement. The right approach would probably be to add stubs on a
as-needed basis instead of trying to provide full coverage.

I agree. It would be too error prone to add it as 1 huge patch. Taking
bite sized chunks would be better, as long as they are all functional.

Usage examples:
* Test the behavior of a device driver
As various kernel functions can be overridden a test case could
be written to simulate a given device and
check that there are no regressions in the driver

Not sure that is a good use. If we want to emulate hardware I think
we're better of using qemu for it and run a normal kernel under it.

Agreed.

* Regression testing
Any time a regression is found and fixed in the kernel a test
case could be written to check that the
regression does not reoccur later on.

I think that is the primary use case. Regresion-tests for library-ish
code that doesn't require much global state.

I think that would be a good starting point, but I would like to extend
the testing to as much of the kernel as possible over time. I know it's
difficult because of the global state but in theory it should be
possible.

Thanks,

Jack
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Frameworks [WAS: Cost of developing a device driver]
    ... in the kernel, there were issues with the DW drivers I developed that I ... >> Just because Windows kernel development is stuck in the stone age doesn't ... > actually love to see a good framework for Windows kernel development (I ... > developers take existing code for a driver and turn it into a new driver. ...
    (microsoft.public.development.device.drivers)
  • Re: [GIT PATCH] UIO patches for 2.6.21
    ... GPL'ed kernel rather than encouraging them to do closed-source userspace ... driver" framework very well for a variety of reasons: ... But yes, it does allow you to write a PCI driver in userspace, being ...
    (Linux-Kernel)
  • Re: Fwd: PCF8583 not detected on RiscPC
    ... It's a regression, it needs fixing. ... last time I tested which was a 2.6.27-rc kernel. ... I've said it's the PCF8583 driver. ... It's a bit banged I2C bus. ...
    (Linux-Kernel)
  • Re: Fwd: PCF8583 not detected on RiscPC
    ... It's a regression, it needs fixing. ... If every single kernel has to be tested on every single machine to find ... I've said it's the PCF8583 driver. ... It's a bit banged I2C bus. ...
    (Linux-Kernel)
  • Re: sensors fun..
    ... The goal of this framework is ... IMO to "collect" all this data in the kernel and provide a single ... point of contact for the userland to query this in-kernel data. ... I will answer to your mail where I talked about access to ISA stuff as time permits, and I try to do it in a verbose way so that the picture about Constantine's sensors framework is more clear. ...
    (freebsd-arch)