Re: [LTP] [PATCH 02/05] Add Script which would actually do the job of injecting faults

Subrata Modak
2009-08-12T11:21:22Z

On Wed, 2009-08-12 at 01:45 -0700, Garrett Cooper wrote:
> On Tue, Aug 11, 2009 at 10:30 AM, Subrata
> Modak<subrata@linux.vnet.ibm.com> wrote:
> > Script which would actually do the job of injecting faults by changing various
> > parametrs available under /debug/fail*. This would be done dynamically during
> > LTP run, and, is capable of taking parameters from 0 to 100 to vary the
> > probability of Fault the user wants to inject in the running kernel.
> >
> > Signed-off-by: Subrata Modak <subrata@linux.vnet.ibm.com>
> > ---
> >
> > diff -uprN ltp-full-20090731.orig/tools/insert_kernel_faults.sh ltp-full-20090731/tools/insert_kernel_faults.sh
> > --- ltp-full-20090731.orig/tools/insert_kernel_faults.sh 1970-01-01 05:30:00.000000000 +0530
> > +++ ltp-full-20090731/tools/insert_kernel_faults.sh 2009-08-11 18:44:45.000000000 +0530
> > @@ -0,0 +1,52 @@
> > +#!/bin/sh
> > +################################################################################
> > +## ##
> > +## Copyright (c) International Business Machines Corp., 2009 ##
> > +## ##
> > +## This program is free software; you can redistribute it and/or modify ##
> > +## it under the terms of the GNU General Public License as published by ##
> > +## the Free Software Foundation; either version 2 of the License, or ##
> > +## (at your option) any later version. ##
> > +## ##
> > +## This program is distributed in the hope that it will be useful, but ##
> > +## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
> > +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
> > +## for more details. ##
> > +## ##
> > +## You should have received a copy of the GNU General Public License ##
> > +## along with this program; if not, write to the Free Software ##
> > +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##
> > +## ##
> > +################################################################################
> > +# ##
> > +# File : insert_kernel_faults.sh ##
> > +# ##
> > +# Usage: insert_kernel_faults.sh <fault_percentage> ##
> > +# ##
> > +# Description: This is a simple script that inserts faults at various ##
> > +# subsystems of the kernel. Please refer to the ltp/README ##
> > +# for the various kernel CONFIG options needed to exploit ##
> > +# all those features ##
> > +# ##
> > +# Author: Subrata Modak <subrata@linux.vnet.ibm.com> ##
> > +# ##
> > +# History: Aug 11 2009 - Created - Subrata Modak. ##
> > +################################################################################
> > +
> > +if [ -z $1 ]
> > + then
> > + #Check if Useage has been proper
> > + echo "Usage: $0 <fault_percentage>"
> > + exit 1
> > +fi
> > +
> > +#These are the types of Subsystems where fault will be injected
> > +#Make sure debugfs has been mounted
> > +for FAILTYPE in `echo fail_io_timeout fail_make_request fail_page_alloc failslab`
> > +do
> > + echo $1 > /debug/$FAILTYPE/probability
> > + echo 100 > /debug/$FAILTYPE/interval
> > + echo -1 > /debug/$FAILTYPE/times
> > + echo 0 > /debug/$FAILTYPE/space
> > +done
>
> Why ```for FAILTYPE in `echo list-of-values`'''? ```for FAILTYPE
> in list-of-values''' works just as well without the echo.

Oops. True. I will do that. Let me hear some more comments from people
and i will redo the patches again.

Regards--
Subrata

> Thanks,
> -Garrett