Unit Testing Memory Mapped Device Drivers
summary
Presents a concrete pattern to unit test memory-mapped drivers by replacing direct dereferences with a hookable EC_REGGE macro that redirects reads/writes to fake registers, building tests with Native Sim on POSIX and a DTS overlay, using the virtual interrupt controller and work queues for kernel behavior. Implements level-trigger emulation, reaches 100% unit test coverage before changing code, and the feature works on real hardware on first try.
AI-written summary · about
chapters (9)
- 0:00Unit testing device drivers
- 2:13Why unit testing matters
- 4:00IT GPIO driver case study
- 10:08Register access interception
- 13:48Register side effects and limits
- 16:57Pure unit testing limits
- 19:25New level interrupt testing
- 21:38Success with test-first development
- 22:00Q&A
related talks
26mUnit Testing Memory Mapped Device Drivers
01h 01mSimulating Low-Level Hardware Devices in Cpp
01h 01mAdvanced Unit Testing in C & C++
18mTesting Intel TDX functionality with new set of self tests
28mTesting Drivers with KUnit (Does hardware have to be hard?)
01h 22mTest-Driven Development of C++ Embedded and System-Level Software
20mHow to Mock in the 21st Century
55mComprehensive Testing of Embedded Software
