linux.conf.au
44 minutes
KUnit runs small tests inside a running kernel, so code that can only work in kernel space can still be tested piece by piece. In Rust you mark a block of tests with an attribute and they are compiled into the kernel only when testing is switched on. That lets you check the logic in your driver, such as how it builds a register value, without any hardware at all. Without it, your only test is loading the whole driver and hoping.