Kernel Device Driver Testing

tedheadster tedheadster at
Wed Nov 8 16:57:09 UTC 2017

  I had an idea about device drivers and self-tests. Create a compiler
tag called __selftest which would function similar to __init. A device
driver author could write directly into their kernel module self-test
functions identified with this tag.

Using the tag, the person compiling the kernel could:

1) Completely remove the code/data at compile-time.
2) Have the code run once at boot and then free the memory after a single use.
3) Leave the code in place and expose it to userland via the debugfs
filesystem. Users could run the tests at their pleasure.

It would be an opt-in system, so existing drivers could have the code
added at your leisure.

What are your thoughts on this idea?

- Matthew Whitehead

More information about the devel mailing list