subrata_modak | 1b9e21d | 2009-08-22 12:44:23 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | ################################################################################ |
| 3 | ## ## |
| 4 | ## Copyright (c) International Business Machines Corp., 2009 ## |
| 5 | ## ## |
| 6 | ## This program is free software; you can redistribute it and/or modify ## |
| 7 | ## it under the terms of the GNU General Public License as published by ## |
| 8 | ## the Free Software Foundation; either version 2 of the License, or ## |
| 9 | ## (at your option) any later version. ## |
| 10 | ## ## |
| 11 | ## This program is distributed in the hope that it will be useful, but ## |
| 12 | ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## |
| 13 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## |
| 14 | ## for more details. ## |
| 15 | ## ## |
| 16 | ## You should have received a copy of the GNU General Public License ## |
| 17 | ## along with this program; if not, write to the Free Software ## |
Wanlong Gao | 4548c6c | 2012-10-19 18:03:36 +0800 | [diff] [blame] | 18 | ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## |
subrata_modak | 1b9e21d | 2009-08-22 12:44:23 +0000 | [diff] [blame] | 19 | ## ## |
| 20 | ################################################################################ |
| 21 | # ## |
| 22 | # File : insert_kernel_faults.sh ## |
| 23 | # ## |
| 24 | # Usage: insert_kernel_faults.sh <fault_percentage> ## |
| 25 | # ## |
| 26 | # Description: This is a simple script that inserts faults at various ## |
| 27 | # subsystems of the kernel. Please refer to the ltp/README ## |
| 28 | # for the various kernel CONFIG options needed to exploit ## |
| 29 | # all those features ## |
| 30 | # ## |
| 31 | # Author: Subrata Modak <subrata@linux.vnet.ibm.com> ## |
| 32 | # ## |
| 33 | # History: Aug 11 2009 - Created - Subrata Modak. ## |
| 34 | # Aug 17 2009 - Changed the debugfs mount point - Subrata Modak.## |
| 35 | ################################################################################ |
| 36 | |
| 37 | if [ -z "$1" ] |
| 38 | then |
| 39 | #Check if Useage has been proper |
| 40 | echo "Usage: $0 <fault_percentage>" |
| 41 | exit 1 |
| 42 | fi |
| 43 | |
| 44 | #These are the types of Subsystems where fault will be injected |
| 45 | #Make sure debugfs has been mounted |
| 46 | for FAILTYPE in fail_io_timeout fail_make_request fail_page_alloc failslab |
| 47 | do |
| 48 | echo $1 > /sys/kernel/debug/$FAILTYPE/probability |
| 49 | echo 100 > /sys/kernel/debug/$FAILTYPE/interval |
| 50 | echo -1 > /sys/kernel/debug/$FAILTYPE/times |
| 51 | echo 0 > /sys/kernel/debug/$FAILTYPE/space |
| 52 | done |
| 53 | |