From 0caac11ca81e1d2e66bfe3e45ad6c33ae05eceaa Mon Sep 17 00:00:00 2001 From: whaffman Date: Sun, 19 Jan 2025 16:27:38 +0100 Subject: [PATCH] update README --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8a433d..dd77277 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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. +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 @@ -10,7 +10,17 @@ 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: +### Script Usage +The script `funfail.sh` can be used to run your program with the funfail.so preloaded. + +To run your program `myapp` and simulate a failure in `malloc` after 10 calls, use: +``` +./funfail.sh ./myapp +``` +Follow the prompts to select `malloc` and enter `10` as the number of calls after which it should fail. + +### Manual Usage +Copy the funfail.so to the path of the program `myapp` 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 @@ -20,3 +30,4 @@ Example: ``` LD_PRELOAD=./funfail.so MAX_MALLOC_CALLS=5 ./myapp ``` +