4 ms·
My fav little-known trick is to test various syscalls fail with strace fault injection, like: $ strace -e trace=clone -e fault=clone:error=EAGAIN random lin
by majke 1y ago
My fav little-known trick is to test various syscalls fail with strace fault injection, like:
$ strace -e trace=clone -e fault=clone:error=EAGAIN
random link: https://medium.com/@manav503/using-strace-to-perform-fault-injection-in-system-calls-fcb859940895 https://medium.com/@manav503/using-strace-to-perform-fault-i...
- jonhohle 1y agoThis is incredible and something I’d wish I’d known about a long time ago. I’d often stub out functions like this knowing I couldn’t test the failure branch, but try to limit that to as small an area as possible. Thanks!
- ycombinatrix 1y agoThis is great. Anyone know of an equivalent in Windows?
- dwattttt 1y agoApplication Verifier provides fault injection, as well as detection for a bunch of conditions (https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/application-verifier https://learn.microsoft.com/en-us/windows-hardware/drivers/d...). It's only intended for native/unmanaged code though.
- colejohnson66 1y agoThe recommended approach for managed apps (meaning .NET) is probably dependency injection. If you want to test a component with fallible methods, write an interface wrapper and inject a fallible mock. The JIT will do dynamic PGO and devirtualize in normal application usage.
- broken_broken_ 1y agoDtrace can do the same and much more I believe with destructive actions, and it is supported on Windows.
- cenamus 1y agoAnd OpenBSD? :D
- eru 1y agoYou might also like https://github.com/eradman/entr https://github.com/eradman/entr