Change the runltp script to actually create an interface for the user: 1) Introduce a new option "-F" for ability to run tests under "Fault Injection Framework", 2) "./runltp -h" will display the new option, 3) Verifies whether Kernel has built-in capabilities for "Fault Injection",
Signed-off-by: Subrata Modak <[email protected]> --- --- ltp-full-20090731.orig/runltp 2009-08-11 16:55:24.000000000 +0530 +++ ltp-full-20090731/runltp 2009-08-11 20:28:58.000000000 +0530 @@ -106,6 +106,7 @@ usage() usage: ./${0##*/} [ -a EMAIL_TO ] [ -c NUM_PROCS ] [ -C FAILCMDFILE ] [ -d TMPDIR ] [ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG ] -e [ -f CMDFILES(,...) ] [ -g HTMLFILE] [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ] + [ -F LOOPS,PERCENTAGE ] -N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] -v [ -w CMDFILEADDR ] [ -x INSTANCES ] [ -b DEVICE ] [-B DEVICE_FS_TYPE] @@ -123,6 +124,7 @@ usage() [CLEAN_FLAG = unlink file to which random data written, when value 1] -e Prints the date of the current LTP release -f CMDFILES Execute user defined list of testcases (separate with ',') + -F LOOPS,PERCENTAGE Induce PERCENTAGE Fault in the Kernel Subsystems, and, run each test for LOOPS loop -g HTMLFILE Create an additional HTML output format -h Help. Prints all available options. -i NUM_PROCS Run LTP under additional background Load on IO Bus @@ -180,6 +182,9 @@ main() local DURATION="" local CMDFILEADDR="" local FAILCMDFILE="" + local INJECT_KERNEL_FAULT="" + local INJECT_KERNEL_FAULT_PERCENTAGE="" + local INJECT_FAULT_LOOPS_PER_TEST="" local LOGFILE_NAME="" local LOGFILE="" local OUTPUTFILE_NAME="" @@ -193,7 +198,7 @@ main() local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"` version_date=`head -n 1 $LTPROOT/ChangeLog` - while getopts a:c:C:d:D:f:ehi:g:l:m:Nno:pqr:s:t:T:vw:x:b:B: arg + while getopts a:c:C:d:D:f::F:ehi:g:l:m:Nno:pqr:s:t:T:vw:x:b:B: arg do case $arg in a) EMAIL_TO=$OPTARG ALT_EMAIL_OUT=1;; @@ -263,6 +268,18 @@ main() # Can be more then one file, just separate it with ',', like: # -f nfs,commands,/tmp/testfile CMDFILES=$OPTARG;; + F) INJECT_KERNEL_FAULT=1 + #Seperate out the NO_OF_LOOPS & FAULT_PERCENTAGE + INJECT_FAULT_LOOPS_PER_TEST=`echo $OPTARG |cut -d',' -f1 | tr -d '\n' | tr -d ' '` + INJECT_KERNEL_FAULT_PERCENTAGE=`echo $OPTARG |cut -d',' -f2 | tr -d '\n' | tr -d ' '` + if [ ! $INJECT_FAULT_LOOPS_PER_TEST ]; then + echo "Loops not properly defined. Resorting to default 5..." + export INJECT_FAULT_LOOPS_PER_TEST=5 + fi + if [ ! $INJECT_KERNEL_FAULT_PERCENTAGE ]; then + echo "Fault Persentage not properly defined. Resorting to default 10..." + export INJECT_KERNEL_FAULT_PERCENTAGE=10 + fi;; g) HTMLFILE_NAME="$OPTARG" case $OPTARG in /*) @@ -738,6 +755,28 @@ main() echo "Running tests......." test_start_time=$(date) + # User wants testing with Kernel Fault Injection + if [ $INJECT_KERNEL_FAULT -eq 1 ] ; then + #See if Debugfs is mounted, and + #Fault Injection Framework available through Debugfs + if [ -d "/debug/fail_io_timeout" -o \ + -d "/debug/fail_make_request" -o \ + -d "/debug/fail_page_alloc" -o \ + -d "/debug/failslab" ]; then + #If atleast one of the Framework is available + #Go ahead to Inject Fault & Create required + #Command Files for LTP run + echo Running tests with Fault Injection Enabled in the Kernel... + ${LTPROOT}/tools/create_kernel_faults_in_loops_and_probability.pl\ + ${TMP}/alltests $INJECT_FAULT_LOOPS_PER_TEST $INJECT_KERNEL_FAULT_PERCENTAGE > ${TMP}/alltests.tmp + cp ${TMP}/alltests.tmp ${TMP}/alltests + rm -rf ${TMP}/alltests.tmp + else + echo Fault Injection not enabled in the Kernel.. + echo Running tests normally... + fi + fi + # Some tests need to run inside the "bin" directory. cd "${LTPROOT}/testcases/bin" ${LTPROOT}/pan/ltp-pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE --- Regards-- Subrata ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
