From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by h25xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MavBi-0001N0-Ps for ltp-list@lists.sourceforge.net; Tue, 11 Aug 2009 17:31:06 +0000 Received: from e1.ny.us.ibm.com ([32.97.182.141]) by 3b2kzd1.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1MavBe-00058y-A3 for ltp-list@lists.sourceforge.net; Tue, 11 Aug 2009 17:31:06 +0000 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e1.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id n7BHUrhq007753 for ; Tue, 11 Aug 2009 13:30:53 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n7BHUuE3254486 for ; Tue, 11 Aug 2009 13:30:56 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n7BHUunD008303 for ; Tue, 11 Aug 2009 13:30:56 -0400 From: Subrata Modak Date: Tue, 11 Aug 2009 23:00:48 +0530 Message-Id: <20090811173048.7074.51813.sendpatchset@subratamodak.linux.ibm.com> In-Reply-To: <20090811172957.7074.62874.sendpatchset@subratamodak.linux.ibm.com> References: <20090811172957.7074.62874.sendpatchset@subratamodak.linux.ibm.com> Subject: [LTP] [PATCH 04/05] Add Script which will be at the heart of this infrastructure List-Id: Linux Test Project General Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-list-bounces@lists.sourceforge.net To: LTP Mailing List Cc: Sachin P Sant , Mike Frysinger , Michael Reed , Nate Straz , Paul Larson , Manoj Iyer , Balbir Singh At the heart of this infrastructure is this Script, which will actually: 1) Change the temporary command file generated by runltp, 2) Create a new temporary command file which will have the following entries against each one entry in the command file: i) Same TAG COMMAND_LINE entry, ii) Entry to call the script to insert faults, iii) Entry to run as many loops as specified by the user, iv) Entry to call the script to restore kernel to default state, It is capable of creating new entries in the temporary command file with the following tags and command lines: TAG_NAME=tag1, COMMANDLINE="test1", TAG_NAME=tag1_loop1, COMMANDLINE="insert_fault_in_kernel; test1", TAG_NAME=tag1_loop2, COMMANDLINE="test1", ... TAG_NAME=tag1_loopn, COMMANDLINE="test1; restore_default_kernel", Signed-off-by: Subrata Modak --- diff -uprN ltp-full-20090731.orig/tools/create_kernel_faults_in_loops_and_probability.pl ltp-full-20090731/tools/create_kernel_faults_in_loops_and_probability.pl --- ltp-full-20090731.orig/tools/create_kernel_faults_in_loops_and_probability.pl 1970-01-01 05:30:00.000000000 +0530 +++ ltp-full-20090731/tools/create_kernel_faults_in_loops_and_probability.pl 2009-08-11 20:23:54.000000000 +0530 @@ -0,0 +1,97 @@ +#!/usr/bin/perl +################################################################################ +## ## +## 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 : create_kernel_faults_in_loops_and_probability.pl ## +# ## +# Usage: create_kernel_faults_in_loops_and_probability.pl\ ## +# \ ## +# ## +# ## +# Description: This is a simple perl script which will take ltp command file ## +# as input and then create a final command file while will have ## +# the following entries for each test tag: ## +# 1) ## +# 2) ## +# 3) tag entried from loop3 to loop(n-1) ## +# 4) ## +# ## +# Author: Subrata Modak ## +# ## +# History: Aug 11 2009 - Created - Subrata Modak. ## +################################################################################ + +my $command_file = shift (@ARGV) || syntax(); +my $loops = shift (@ARGV) || syntax(); +my $failure_probability = shift (@ARGV) || syntax(); + +sub syntax() { + print "syntax: create_fault_in_loops_and_probability.pl\ + \ + \n"; + exit (1); +} +#$ENV{TEST_START_TIME}) + + +open (FILE, $command_file) || die "Cannot open file: $command_file\n"; +while ($line = ) { + if ($line =~ /^#/) { + print "$line"; + next; + } + if ($line =~ /^\n$/) { + next; + } + chomp $line; + print "$line\n"; #Print one instance for stable execution + @tag_and_actual_command = split(/\ /, $line); + + #The remaining loops should be running under fault injection + for ($counter=1; $counter<=$loops; $counter++) { + my $token_counter = 0; + foreach my $token (@tag_and_actual_command) { + if ($token_counter == 0 ) { + #Time to append the actual command tag with the loop no. + print $token . "_loop_" . $counter . " "; + $token_counter++; + next; + } + if ($token_counter == 1 && $counter == 1) { + #Time to include the fault injection script in the first loop + print "\$LTPROOT/tools/insert_kernel_faults.sh " . $failure_probability . "; " . $token; + $token_counter++; + next; + } + print " " . $token . " "; + } + if ($counter == $loops) { + #Time to withdraw the faults once the last loop has been executed + #Until all faults has been successfully restored to default values... + #Keep restoring them + print "; " . "\$LTPROOT/tools/restore_kernel_faults_default.sh; RC=\$?; while [ \$RC -ne 0 ]; do \$LTPROOT/tools/restore_kernel_faults_default.sh; RC=\$?; done\n" + } else { + print "\n" + } + } + +} +close (FILE); + --- 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