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