|
|
Subscribe / Log in / New account

A kernel unit-testing framework

A kernel unit-testing framework

Posted Mar 4, 2019 19:32 UTC (Mon) by Cyberax (✭ supporter ✭, #52523)
In reply to: A kernel unit-testing framework by pbonzini
Parent article: A kernel unit-testing framework

Some devices will probably always be impractical, like GPUs. These days they are separate computers in their own right and probably should be emulated with something like qemu.

However lots of other devices most definitely can be simulated.

Simulation also doesn't have to be perfect to be useful. Just something good enough will suffice.


to post comments

A kernel unit-testing framework

Posted Mar 4, 2019 21:13 UTC (Mon) by pizza (subscriber, #46) [Link]

> Simulation also doesn't have to be perfect to be useful. Just something good enough will suffice.

"All models are wrong. Some are useful."

But the "useful" threshold varies widely depending on what you're trying to accomplish.

The majority of my headaches with respect to device drivers was due to the hardware not working the way it was documented. Spurious interrupts, clock phasing, interactions/collisions with shared resources, subtle sleep/wake sequencing issues, sensitivity to environmental conditions (eg clocks drifting between -40C -> 85C), dma peripheral quirks, workarounds for things fixed in later revisions.. and so forth.

Granted, I also had plenty of headaches due to the upper stacks not behaving as specified either. Or perhaps I should say significantly underspecified -- While it was actually well-tested (unit and system-level) the tests were written from the same incorrect/incomplete set of spherical-cow specifications/assumptions.

A kernel unit-testing framework

Posted Mar 4, 2019 22:51 UTC (Mon) by pbonzini (subscriber, #60935) [Link] (1 responses)

WiFi would also be all but impractical.

USB would only be practical if you also emulated all the broken devices around to ensure they don't regress. Same for the "generic" drivers like AHCI or SDHCI.

Some mock devices are there, for example scsi_debug, the tests are in user space rather than kernel.

A kernel unit-testing framework

Posted Mar 14, 2019 3:22 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link]

WiFi is actually quite practical, its control protocols are quite complicated and are a prime target for mock-based unit tests. Integration tests are indeed very complicated, though.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds