Go to file
2025-01-19 16:24:13 +01:00
src made script and finished for read write malloc and calloc 2025-01-19 16:24:13 +01:00
funfail.sh made script and finished for read write malloc and calloc 2025-01-19 16:24:13 +01:00
Makefile initial 2025-01-19 15:55:55 +01:00
README.md README 2025-01-19 16:05:20 +01:00

FunFail

Funfail is a shared library that is used to simulate failures in memory allocation (malloc, calloc) and I/O operations (write, read) after a set number of uses. This can be useful for testing the robustness and error-handling capabilities of your programs.

Usage

After making the shared object:

make

Copy the funfail.so to the path of the program you want to test. Preloading the funfail.so can be done using the LD_PRELOAD environment variable in Linux. Run your program while preloading the funfail.so and use one of the following env variables:

  • MAX_MALLOC_CALLS
  • MAX_CALLOC_CALLS
  • MAX_WRITE_CALLS
  • MAX_READ_CALLS

Example:

LD_PRELOAD=./funfail.so MAX_MALLOC_CALLS=5 ./myapp