4 ms·
Unit tests are not the only way, or the best way, to test software.
by ylyn 5y ago
Unit tests are not the only way, or the best way, to test software.
- Dylan16807 5y agoSure? The note is that it is not a way here.
- egberts 5y agoBecause a kernel is not a user-land?
- zibzab 5y agoI agree with parent that unit testing privileged bare metal code is not always possible, at least not without spending 10x-100x dev time on writing tests. Example: anything that directly accesses MMU or caches.
- rurban 5y agoOn the contrary, simulating MMU or caches are trivial. You can create a memory subsystem mock in a few hours. IO, assembly and interrupts are much harder.
- zibzab 5y agoHow would you create a mock object for something that modifies the memory layout of the unit test while it is running?
- Dylan16807 5y ago> How would you create a mock object for something that modifies the memory layout of the unit test while it is running? There's two ways I can interpret "the unit test". 1) "How would you create a mock object for modifying the memory layout of the code being tested?" That's just a routine that shuffles around some bytes. Or marks parts of the address space to fault so it can simulate the contents. 2) "How would you create a mock object for modifying the memory layout of the code performing the test?" That wouldn't be a test. The code performing the test isn't inside its own simulation.
- rurban 5y agoYou create your mmap's on init. The MMU is just a simple 3way array lookup, as a Unicode table.
- yencabulator 5y agoUnicode?
- Too 5y agoPerhaps there was an /s missing in parent post? Implying that unit testing is often prioritized more by management, over checking security, configuration and tools like this one.