Nov 13 – 15, 2023
America/New_York timezone

Testing Drivers with KUnit (Does hardware have to be hard?)

Nov 13, 2023, 10:30 AM
"Potomac G" (Omni Richmond Hotel)

"Potomac G"

Omni Richmond Hotel

Kernel Testing & Dependability MC Kernel Testing & Dependability MC


David Gow (Google)


Unit testing common library code is (relatively) easy, but drivers often deal with a lot of global state, both in code and in hardware. New features like static stubbing go some way towards making this easier, but a lot of work still goes into making "fake devices".

There are still many open questions, however:
- Are the existing tools helping? Is there something obviously missing?
- Are UML features like LOGIC_IOMEM a good path forward?
- How should drivers make a fake 'struct device'? Via a platform_device (possibly with devicetree support), root_device, or a new kunit_device?
- There are lots of ways of managing resources for tests (kunit_resource, KUnit actions, devres/devm_ APIs). What should we use, when?
- How do we deal with callbacks, threads, etc, with KUnit contexts?
- How to support other safety/reliability/testing opportunities like hardware fuzzing and Rust?

Primary author

David Gow (Google)

Presentation materials

Diamond Sponsors

Platinum Sponsor
Gold Sponsors

Silver Sponsors

Catchbox Sponsor
Livestream Sponsors

T-Shirt Sponsor
Conference Services Provided by