18–20 Sept 2024
Europe/Vienna timezone

KUnit for userspace

20 Sept 2024, 10:30
30m
"Hall N2" (Austria Center)

"Hall N2"

Austria Center

161
Kernel Testing & Dependability MC Kernel Testing & Dependability MC

Speaker

David Gow (Google)

Description

There are several different testing frameworks for kernel and kernel-adjacent code, but KUnit is one of the most consistent and user-friendly. This means that KUnit is being used for things beyond its nominal scope of 'unit tests'. This includes stress tests, integration tests, and performance tests.

On the flipside, there are unit tests in the kernel tree for which KUnit's in-kernel nature is suboptimal. Some kernel code is self-contained enough that it can run (and be tested) without needing to boot an entire kernel (even a UML one). It's also convenient to be able to have smaller, faster tests to hand to other projects (e.g. compiler vendors). And some tools (e.g., perf) live in the kernel tree, but run in userspace, and so can't use KUnit directly.

These 'fully-userspace unit tests' currently use ad-hoc frameworks, which are often inspired by KUnit, but are not otherwise standardised. Can we improve this by:
- Developing a standard framework for 'fully-userspace tests'?
- Making this API as compatible with KUnit as possible (allowing, ideally, tests to be trivially ported back and forth, or run both in-kernel and in userspace)?
- Make it easier to use KUnit tools, features, and APIs outside a formal KUnit test?

Primary author

David Gow (Google)

Presentation materials