Toward a real "too small to fail" rule
Toward a real "too small to fail" rule
Posted Mar 19, 2024 6:31 UTC (Tue) by PengZheng (subscriber, #108006)In reply to: Toward a real "too small to fail" rule by koverstreet
Parent article: Toward a real "too small to fail" rule
> The thing that's made this hard in the past is that you need to be specific about which allocation callsites you're injecting errors into, or your tests will fail in ways that you weren't expecting. That's the capability we don't have yet: we have error injection in the kernel, but it doesn't have facilities for defining per callsite injection points and I've never seen anyone use it for testing memory allocation failures.
We did lots of memory allocation error injections in unit tests, though in user space.
And the error injectors are very easy to write, which are actually generated by GitHub Copilot.
https://github.com/apache/celix/blob/master/libs/error_in...
The way to use it is quite straightforward: just link to the CMake target Celix::malloc_ei.
Specifying precise call sites to fail is also easier:
https://github.com/apache/celix/blob/master/libs/error_in...
