public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Subrata Modak <subrata@linux.vnet.ibm.com>
To: LTP Mailing List <ltp-list@lists.sourceforge.net>
Cc: Sachin P Sant <sachinp@linux.vnet.ibm.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Michael Reed <mreed10@us.ibm.com>, Nate Straz <nate@refried.org>,
	Paul Larson <paul.larson@ubuntu.com>,
	Manoj Iyer <manoj.iyer@ubuntu.com>,
	Balbir Singh <balbir@linux.vnet.ibm.com>
Subject: [LTP] [PATCH v2 05/05] Add the necessary Interface and Option through "runltp"
Date: Mon, 17 Aug 2009 17:40:28 +0530	[thread overview]
Message-ID: <20090817121026.8902.3224.sendpatchset@subratamodak.linux.ibm.com> (raw)
In-Reply-To: <20090817120835.8902.4597.sendpatchset@subratamodak.linux.ibm.com>

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",

This has no much difference from the last version, except that 'runltp'
has changed in between to include Paul's -S option. This has just been
created over top of it. I will try to move the 'debugfs' checking
logic out of 'runltp' some time in future.

Signed-off-by: Subrata Modak<subrata@linux.vnet.ibm.com>
---

--- ltp-full-20090731.orig/runltp	2009-08-17 10:46:41.000000000 +0530
+++ ltp-full-20090731/runltp	2009-08-17 11:40:34.000000000 +0530
@@ -62,6 +62,8 @@
 #               - Added a new option to mail back LTP reports
 #               May 19 2008 - Modified - Subrata Modak
 #               - Added capability for default Log file generation
+#		Aug 17 2009 - Modified - Subrata Modak
+#		- Added Fault Injection generation Capability through -F Option
 #
 #################################################################################
 
@@ -108,6 +110,7 @@ usage() 
     [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ] 
     -N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ]
     -v [ -w CMDFILEADDR ] [ -x INSTANCES ] [ -b DEVICE ] [-B DEVICE_FS_TYPE]
+	[ -F LOOPS,PERCENTAGE ]
                 
     -a EMAIL_TO     EMAIL all your Reports to this E-mail Address
     -c NUM_PROCS    Run LTP under additional background CPU load
@@ -123,6 +126,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
@@ -181,6 +185,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=""
@@ -194,7 +201,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:S:t:T:vw:x:b:B: arg
+    while getopts a:c:C:d:D:f:F:ehi:g:l:m:Nno:pqr:s:S:t:T:vw:x:b:B: arg
     do  case $arg in
         a)  EMAIL_TO=$OPTARG
             ALT_EMAIL_OUT=1;;
@@ -264,6 +271,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
             /*)
@@ -754,6 +773,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 "/sys/kernel/debug/fail_io_timeout" -o \
+			-d "/sys/kernel/debug/fail_make_request" -o \
+			-d "/sys/kernel/debug/fail_page_alloc" -o \
+			-d "/sys/kernel/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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2009-08-17 12:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17 12:08 [LTP] [PATCH v2 00/05] Integration of "Fault Injection Framework" into LTP Subrata Modak
2009-08-17 12:08 ` [LTP] [PATCH v2 01/05] Provide all necessary information through ltp/README Subrata Modak
2009-08-17 12:09 ` [LTP] [PATCH v2 02/05] Add Script which would actually do the job of injecting faults Subrata Modak
2009-08-17 17:11   ` Garrett Cooper
2009-08-17 17:44     ` Subrata Modak
2009-08-17 12:09 ` [LTP] [PATCH v2 03/05] Add Script so the kernel is restored back to its original pristine form Subrata Modak
2009-08-17 12:10 ` [LTP] [PATCH v2 04/05] Add Script which will be at the heart of this infrastructure Subrata Modak
2009-08-17 12:10 ` Subrata Modak [this message]
2009-08-17 12:10 ` [LTP] [RESULTS v2] Results of test run for "Fault Injection Framework" Subrata Modak
2009-08-22 13:01 ` [LTP] [PATCH v2 00/05] Integration of "Fault Injection Framework" into LTP Subrata Modak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090817121026.8902.3224.sendpatchset@subratamodak.linux.ibm.com \
    --to=subrata@linux.vnet.ibm.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=manoj.iyer@ubuntu.com \
    --cc=mreed10@us.ibm.com \
    --cc=nate@refried.org \
    --cc=paul.larson@ubuntu.com \
    --cc=sachinp@linux.vnet.ibm.com \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox