4 ms·
Giant refactor + no unit tests = data loss. The history of Linux in a nutshell.
by jeffbee 3y ago
Giant refactor + no unit tests = data loss. The history of Linux in a nutshell.
- patrakov 3y agoI wouldn't say "no unit tests". There are xfstests, the problem is that nobody runs them on stable backports to verify their correctness and completeness.
- jeffbee 3y agoxfstests are not unit tests, they are integration stress tests, and their coverage is quite poor. Nothing in that suite exercises `xfs_bmap_btalloc_at_eof` particularly. That's the kind of unit test you want before undertaking a large refactor. There are several testable postconditions that would be trivial to test, if this code had an easy way to add and run unit tests. It has two mutable (in-out) parameters and a comment that says allocation returns as if the function was never called. And that is where the bug lies, according to the patch (which also adds or modifies no tests).
- latchkey 3y agoHistory of a lot of (most?) software.
- Paul-Craft 3y agoHow exactly do you propose to unit test code that depends intimately on interactions with hardware that you don't control? Hardware does not always behave according to spec. No matter how good your "simulation mode" is, it will not match the behavior of real hardware. That makes your so called "unit tests" useless in cases where it actually matters. You claim it can be done. Have you ever actually done it? I bet not.