Online / 5 & 6 February 2022


Advanced Unit Testing in the Hedron Microkernel

Concurrent code is hard to get right, but at the same time also hard to test. It gets worse when hardware interaction is required. This leads to a comparatively poor culture of unit testing in kernel code, where both come together.

In this talk, I’m going to highlight one particular method of unit testing the page table manipulation code in Hedron, a microkernel written in C++ specially geared towards virtualization workloads. This code safely modifies page tables that are concurrently used by the CPU. Usually, unit tests only check whether the state after an operation meets the expectation of the programmer. In contrast, Hedron employs completely deterministic unit tests that show that the CPU will always see a valid virtual memory mappings while a page table manipulation is in progress (for the tested cases).

The goal of this task is to show that unit tests can be a powerful tool even for properties of code that are usually not deemed unit testable.


Photo of Julian Stecklina Julian Stecklina