Error injection

Jeremy Allison jra at samba.org
Wed Mar 25 21:46:07 GMT 2009


On Wed, Mar 25, 2009 at 12:59:39PM -0700, Richard Sharpe wrote:
> Hi,
> 
> I have added Error Injection to the Samba 3.0.31 base that is used at
> Data Domain because there was a need for it.
> 
> Here follows the patches between the before-error-injection code and
> the after-error-injection code so that people can see what it
> involves. I hope that this spawns some discussion on the subject of
> error injection in Samba in general, because it is an important tool
> in ensuring good code path coverage in the case of error paths that
> are hard to provoke during testing. It is also a widely used
> technique. I have implemented it in C++ before but this time around I
> have used features from modern C compilers. Configure would have to
> have tests to ensure that C constructors are supported to allow the
> code to be enabled.
> 
> The primary notion is that each source file is a module and an error
> injection table will be produced for each module in which certain
> macros are used. There are some examples of using error injection in a
> couple of modules as well (maybe only one).
> 
> I do not claim that this is the best way to implement error injection,
> and we will probably switch to whatever the Samba team settles on if
> something is decided upon.
> 
> There is still one deficiency in what I have implemented, and that is
> it should be possible to switch on error injection on a program by
> program basis (ie, for smbd only, say, rather than for all programs
> that use a particular module/file). That will be my next internal
> change.
> 
> The way in which error injection is enabled/disabled is conducive to
> being hooked into the smbcontrol framework that James mentioned a few
> days ago.

Very interesting ! The pstrings have got to go for 3.2.x and
above though :-). What about intermittent *alloc failure ?

Jeremy.


More information about the samba-technical mailing list