Hacker News new | ask | show | jobs
by dmarlow 1256 days ago
How is testing done in kernels? Is there unit testing, integration, end to end? I'm unfamiliar, but curious.
4 comments

Not in the Linux kernel. In the Linux kernel it has traditionally always been done by the developer sticking lots of printk statements into their code until they are happy with the outputs and then removing most of them. Make of that what you will.
LOL that is so false that is not even worth correcting.
Actually could you correct it? I don't know anything about the Linux kernel so I'm curious.
I'll correct myself. That was how it was done circa 2000-2005, but my info was way out of date because I haven't followed kernel development much for a while. Here's some stuff about how it's done now. https://www.kernel.org/doc/html/latest/dev-tools/testing-ove...

Basically there is a system called KUnit for writing white box unit tests and there is code coverage to determine coverage as you would expect, then there are systems for static analysis and verifying assertions.

This is so wrong!!
As in that's not how it's done, or that's not how it should be done?
See the following

https://kunit.dev/ - unit tests for kernel

https://docs.kernel.org/dev-tools/testing-overview.html - entire testing overview.

There seems to be a missing piece here. The change that created this includes no tests. It appears to be completely untested.
As you can see from the patch that introduced the bug, the kernel is severely under-tested and has little to no testing culture among the core contributors. The patch changes logic but no tests, indicating that the changed code has insufficient test coverage.