author | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-06-19 18:04:29 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-06-19 18:04:29 UTC |
parent | bcbd7f0f1034c39ea8970b4b94b4bfc837e6d930 |
doc/posix.rst | +21 | -20 |
diff --git a/doc/posix.rst b/doc/posix.rst index 3876320..eecadbf 100644 --- a/doc/posix.rst +++ b/doc/posix.rst @@ -9,7 +9,7 @@ Testing that fault-handling code is a problem because under normal conditions it's hard to make the POSIX functions fail, and generating abnormal conditions is usually difficult. -For example, getting **malloc()** to fail can represent using up all your +For example, getting *malloc()* to fail can represent using up all your memory, and at that point your test case might not even work. Or getting I/O operations to fail might involve filling up the disk which is very undesirable, or generating a very special environment which is difficult to @@ -28,19 +28,19 @@ The first of those tools is an application called *fiu-run*. Suppose you want to run the classic program "fortune" (which some would definitely consider mission critical) and see how it behaves on the presence -of **read()** errors. With **fiu-run**, you can do it like this:: +of *read()* errors. With *fiu-run*, you can do it like this:: $ fiu-run -x -e posix/io/rw/read -p 1 fortune -That enables the failure point with the name **posix/io/rw/read** with 1% -probability to fail **on each call**, and then runs fortune. The *-x* -parameter tells **fiu-run** to enable fault injection in the POSIX API. +That enables the failure point with the name *posix/io/rw/read* with 1% +probability to fail *on each call*, and then runs fortune. The *-x* +parameter tells *fiu-run* to enable fault injection in the POSIX API. Run it several times and you can see that sometimes it works, but sometimes it doesn't, reporting an error reading, which means a *read()* failed as expected. -When fortune is run, every time fortune calls **read()** it has a 1% chance to +When fortune is run, every time fortune calls *read()* it has a 1% chance to fail, which selects an errno at random from the list of the ones that read() is allowed to return. If you want to select an specific errno, you can do it by passing its numerical value using the *-i* parameter. @@ -50,31 +50,32 @@ function that libfiu supports injecting failures to. Not all POSIX is included, but most of the important pieces are, and it is easily extended. See below for details. -To see the list of supported functions and names, see the -**preload/posix/function_list** file that comes in the libfiu tarball. +To see the list of supported functions and names, see the (automatically +generated) *preload/posix/function_list* file that comes in the libfiu +tarball. fiu-ctrl -------- Sometimes it is more interesting to simulate failures at a given point in time -instead of from the beginning, as **fiu-run** does. +instead of from the beginning, as *fiu-run* does. -To that end, you can combine **fiu-run** with the second tool, called +To that end, you can combine *fiu-run* with the second tool, called *fiu-ctrl*. Let's suppose you want to see what the "top" program does when it can't open -files. First, we run it with **fiu-run**:: +files. First, we run it with *fiu-run*:: $ fiu-run -x top -Everything should look normal. Then, in another terminal, we make **open()** +Everything should look normal. Then, in another terminal, we make *open()* fail unconditionally:: $ fiu-ctrl -e posix/io/oc/open `pidof top` After that moment, the top display will probably be empty, because it can't -read process information. Now let's disable that failure point, so **open()** +read process information. Now let's disable that failure point, so *open()* works again:: $ fiu-ctrl -d posix/io/oc/open `pidof top` @@ -85,18 +86,18 @@ And everything should have gone back to normal. How does it work ---------------- -libfiu comes with two preload libraries: **fiu_run_preload** and -**fiu_posix_preload**. +libfiu comes with two preload libraries: *fiu_run_preload* and +*fiu_posix_preload*. -The first one is loaded using **LD_PRELOAD** (see **ld.so(8)** for more -information) by **fiu-run**, and can enable failure points and start libfiu's +The first one is loaded using *LD_PRELOAD* (see *ld.so(8)* for more +information) by *fiu-run*, and can enable failure points and start libfiu's remote control capabilities before the program begins to run. -The second one is also loaded using **LD_PRELOAD** by **fiu-run** when the +The second one is also loaded using *LD_PRELOAD* by *fiu-run* when the *-x* parameter is given, and provides libfiu-enabled wrappers for the POSIX functions, allowing the user to inject failures in them. -**fiu-ctrl** communicates with the applications launched by -**fiu-run** via the libfiu remote control capabilities. +*fiu-ctrl* communicates with the applications launched by +*fiu-run* via the libfiu remote control capabilities.