Home | History | Annotate | Download | only in testscripts
      1 #!/bin/bash
      2 # This script should be run after installing the libaio RPM or libraries
      3 # A valid large file should be passed to the test.
      4 # These tests will only run correctly if the kernel and libaio has been compiled
      5 # with at least a 3.3.X GCC. Older versions of the compiler will seg fault.
      6 #
      7 # 02/08/04 mridge (at] us.ibm.com
      8 #
      9 # 04/12/06 a Forth scenerio file has been added ltp-aiodio.part4
     10 #
     11 
     12 cd `dirname $0`
     13 export LTPROOT=${PWD}
     14 echo $LTPROOT | grep testscripts > /dev/null 2>&1
     15 if [ $? -eq 0 ]; then
     16  cd ..
     17  export LTPROOT=${PWD}
     18 fi
     19 export PATH=$LTPROOT/testcases/bin:$PATH
     20 export TMP=${TMP:=/tmp}
     21 
     22 run0=0
     23 runTest=0
     24 nextTest=0
     25 runExtendedStress=0
     26 
     27 export TMPBASE="/tmp"
     28 usage()
     29 {
     30 	cat <<-END >&2
     31 	usage: ${0##*/} [ -f large_filename -b partition] [-o optional partition] [-e 1] [-t 1] [-j 1] [-x 1] or [-a 1]
     32 
     33 	defaults:
     34 	file1=$file1
     35 	part1=$part1
     36         ext2=0
     37         ext3=0
     38         jfs=0
     39         xfs=0
     40       example: ${0##*/} -f MyLargeFile -b /dev/hdc1 [-o /dev/hdc2] [-a 1] or
     41 [-e 1] [-x 1] [-j 1] [-t 1]
     42         -o = optional partition allows some of the tests to utilize multiple filesystems to further stress AIO/DIO
     43         -e = test ex2 filesystem.
     44         -t = test ext3 filesystem
     45         -j = test JFS filesystem
     46         -x = test XFS filesystem
     47                     or
     48         -a = test all supported filesystems, this will override any other filesystem flags passed.
     49 
     50         - a 1 turns on the test for the above supported filesystem, just omit passing the flag to skip that filesystem.
     51 
     52         - A Large file should be passed to fully stress the test. You must pass at least one filesystem to test, you can pass any combination
     53           but there is not a default filesystem. ReiserFS does not support AIO so these tests will not support ReiserFS.
     54 
     55         - WARNING !! The partition you pass will be overwritten. This is a destructive test so only pass a partition where data can be destroyed.
     56 
     57 
     58 
     59 	END
     60 exit
     61 }
     62 
     63 while getopts :a:b:e:f:t:o:x:j: arg
     64 do      case $arg in
     65 		f)	file1=$OPTARG;;
     66 		b)	part1=$OPTARG;;
     67 		o)	part2=$OPTARG;;
     68 		e)	ext2=$OPTARG;;
     69 		t)	ext3=$OPTARG;;
     70 		x)	xfs=$OPTARG;;
     71 		j)	jfs=$OPTARG;;
     72 		a)	allfs=$OPTARG;;
     73 
     74                 \?)     echo "************** Help Info: ********************"
     75                         usage;;
     76         esac
     77 done
     78 
     79 if [ ! -n "$file1"  ]; then
     80   echo "Missing the large file. You must pass a large filename for testing"
     81   usage;
     82   exit
     83 fi
     84 
     85 if [ ! -n "$part1"  ]; then
     86   echo "Missing the partition. You must pass a partition for testing"
     87   usage;
     88   exit
     89 fi
     90 
     91 if [ -n "$allfs"  ]; then
     92   echo "testing ALL supported filesystems"
     93   ext2="1"
     94   ext3="1"
     95   jfs="1"
     96   xfs="1"
     97   echo "test run = $run0"
     98 fi
     99 
    100 if [ -n "$ext2"  ]; then
    101   echo "** testing ext2 **"
    102   run0=$(($run0+1))
    103 fi
    104 
    105 if [ -n "$ext3"  ]; then
    106   echo "** testing ext3 **"
    107   run0=$(($run0+1))
    108 fi
    109 
    110 if [ -n "$xfs"  ]; then
    111   echo "** testing xfs **"
    112   run0=$(($run0+1))
    113 fi
    114 
    115 if [ -n "$jfs"  ]; then
    116   echo "** testing jfs **"
    117   run0=$(($run0+1))
    118 fi
    119 
    120 if [ -n "$part2" -a "$run0" -gt 1  ]; then
    121   echo "** Running extended stress testing **"
    122   runExtendedStress=1
    123 elif [ -n "$part2" -a "$run0" -eq 1 ]; then
    124   echo " ** You must pass at least 2 filesystems to run an extended AIO stress test **"
    125   usage;
    126 fi
    127 
    128 if [ "$run0" -eq 0 ]; then
    129   echo "No filesystems passed to test"
    130   echo "Please pass at least one supported filesystem or the -a 1 flag to run all "
    131   usage;
    132 fi
    133 
    134 mkdir $TMP  > /dev/null 2>&1
    135 mkdir $TMP/aiodio > /dev/null  2>&1
    136 mkdir $TMP/aiodio2 > /dev/null  2>&1
    137 
    138 while [ "$runTest" -lt "$run0" ]
    139 do
    140 
    141 echo "runTest=$runTest run0=$run0 nextTest=$nextTest"
    142 
    143 if [ -n "$ext2" -a $nextTest -eq 0 ]; then
    144   echo "***************************"
    145   echo "* Testing ext2 filesystem *"
    146   echo "***************************"
    147   mkfs -t ext2 $part1
    148   mount -t ext2 $part1 $TMP/aiodio
    149   if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
    150     mkfs -t ext3 $part2
    151     mount -t ext3 $part2 $TMP/aiodio2
    152   elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
    153     mkfs.jfs  $part2 <testscripts/yesenter.txt
    154     mount -t jfs $part2 $TMP/aiodio2
    155   elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
    156     mkfs.xfs -f $part2
    157     mount -t xfs $part2 $TMP/aiodio2
    158   fi
    159 elif [ $nextTest -eq 0 ]; then
    160   nextTest=$(($nextTest+1))
    161 fi
    162 
    163 if [ -n "$ext3" -a $nextTest -eq 1 ]; then
    164   echo "***************************"
    165   echo "* Testing ext3 filesystem *"
    166   echo "***************************"
    167   mkfs -t ext3 $part1
    168   mount -t ext3 $part1 $TMP/aiodio
    169   if [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
    170     mkfs.jfs  $part2 <testscripts/yesenter.txt
    171     mount -t jfs $part2 $TMP/aiodio2
    172   elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
    173     mkfs.xfs -f $part2
    174     mount -t xfs $part2 $TMP/aiodio2
    175   elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
    176     mkfs -t ext2 $part2
    177     mount -t ext2 $part2 $TMP/aiodio2
    178   fi
    179 elif [ $nextTest -eq 1 ]; then
    180   nextTest=$(($nextTest+1))
    181 fi
    182 
    183 if [ -n "$jfs" -a $nextTest -eq 2 ]; then
    184   echo "**************************"
    185   echo "* Testing jfs filesystem *"
    186   echo "**************************"
    187   mkfs.jfs  $part1 <testscripts/yesenter.txt
    188   mount -t jfs $part1 $TMP/aiodio
    189   if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
    190     mkfs -t ext3  $part2
    191     mount -t ext3 $part2 $TMP/aiodio2
    192   elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
    193     mkfs.xfs -f $part2
    194     mount -t xfs $part2 $TMP/aiodio2
    195   elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
    196     mkfs -t ext2 $part2
    197     mount -t ext2 $part2 $TMP/aiodio2
    198   fi
    199 elif [ $nextTest -eq 2 ]; then
    200   nextTest=$(($nextTest+1))
    201 fi
    202 
    203 if [ -n "$xfs" -a $nextTest -eq 3 ]; then
    204   echo "**************************"
    205   echo "* Testing xfs filesystem *"
    206   echo "**************************"
    207   mkfs.xfs -f $part1
    208   mount -t xfs $part1 $TMP/aiodio
    209   if [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
    210     mkfs -t ext2 $part2
    211     mount -t ext2 $part2 $TMP/aiodio2
    212   elif [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
    213     mkfs -t ext3  $part2
    214     mount -t ext3 $part2 $TMP/aiodio2
    215   elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
    216     mkfs.jfs  $part2 <testscripts/yesenter.txt
    217     mount -t jfs $part2 $TMP/aiodio2
    218   fi
    219 elif [ $nextTest -eq 3 ]; then
    220   nextTest=$(($nextTest+1))
    221 fi
    222 
    223 nextTest=$(($nextTest+1))
    224 runTest=$(($runTest+1))
    225 
    226 mkdir $TMP/aiodio/junkdir
    227 dd if=$file1 of=$TMP/aiodio/junkfile bs=8192 conv=block,sync
    228 
    229 date
    230 echo "************ Running aio-stress tests "
    231 echo "current working dir = ${PWD}"
    232 sort -R ${LTPROOT}/runtest/ltp-aio-stress.part1 -o ${TMPBASE}/ltp-aio-stress.part1
    233 
    234 ${LTPROOT}/bin/ltp-pan -e -S -a ltpaiostresspart1 -n ltp-aiostresspart1 -l ltpaiostress.logfile -o ltpaiostress.outfile -p -f ${TMPBASE}/ltp-aio-stress.part1 &
    235 
    236 wait $!
    237 
    238 sync
    239 echo "************ End Running aio-stress tests "
    240 echo ""
    241 
    242 if [ "$runExtendedStress" -eq 1 ];then
    243 echo "************ Running EXTENDED aio-stress tests "
    244 sort -R ${LTPROOT}/runtest/ltp-aio-stress.part2 -o ${TMPBASE}/ltp-aio-stress.part2
    245 
    246 ${LTPROOT}/bin/ltp-pan -e -S -a ltpaiostresspart2 -n ltp-aiostresspart2 -l ltpaiostress.logfile -o ltpaiostress.outfile -p -f ${TMPBASE}/ltp-aio-stress.part2 &
    247 
    248 wait $!
    249 sync
    250 fi
    251 
    252 dd if=$file1 of=$TMP/aiodio/junkfile bs=8192 conv=block,sync
    253 dd if=$file1 of=$TMP/aiodio/fff      bs=4096 conv=block,sync
    254 dd if=$file1 of=$TMP/aiodio/ff1      bs=2048 conv=block,sync
    255 dd if=$file1 of=$TMP/aiodio/ff2      bs=1024 conv=block,sync
    256 dd if=$file1 of=$TMP/aiodio/ff3      bs=512  conv=block,sync
    257 
    258 echo "************ Running aiocp tests "
    259 sort -R ${LTPROOT}/runtest/ltp-aiodio.part1 -o ${TMPBASE}/ltp-aiodio.part1
    260 
    261 ${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart1 -n ltp-aiodiopart1 -l ltpaiodio1.logfile -o ltpaiodio1.outfile -p -f ${TMPBASE}/ltp-aiodio.part1 &
    262 
    263 wait $!
    264 sync
    265 echo "************ End Running aiocp tests "
    266 echo ""
    267 
    268 echo "************ Running aiodio_sparse tests "
    269 sort -R ${LTPROOT}/runtest/ltp-aiodio.part2 -o ${TMPBASE}/ltp-aiodio.part2
    270 
    271 ${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart2 -n ltp-aiodiopart2 -l ltpaiodio2.logfile -o ltpaiodio2.outfile -p -f ${TMPBASE}/ltp-aiodio.part2 &
    272 
    273 wait $!
    274 sync
    275 echo "************ End Running aiodio_sparse tests "
    276 echo ""
    277 
    278 
    279 if [ "$runExtendedStress" -eq 1 ];then
    280 echo "************ Running fsx-linux tests "
    281 sort -R ${LTPROOT}/runtest/ltp-aiodio.part3 -o ${TMPBASE}/ltp-aiodio.part3
    282 
    283 ${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart3 -n ltp-aiodiopart3 -l ltpaiodio3.logfile -o ltpaiodio3.outfile -p -f ${TMPBASE}/ltp-aiodio.part3 &
    284 
    285 
    286 
    287 wait $!
    288 sync
    289 fi
    290 
    291 dd if=$file1 of=$TMP/aiodio/file2      bs=2048 conv=block,sync
    292 dd if=$file1 of=$TMP/aiodio/file3      bs=1024 conv=block,sync
    293 dd if=$file1 of=$TMP/aiodio/file4      bs=512  conv=block,sync
    294 dd if=$file1 of=$TMP/aiodio/file5      bs=4096 conv=block,sync
    295 
    296 
    297 
    298 
    299 echo "************ Running dio_sparse & miscellaneous tests "
    300 sort -R ${LTPROOT}/runtest/ltp-aiodio.part4 -o ${TMPBASE}/ltp-aiodio.part4
    301 ${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart4 -n ltp-aiodiopart4 -l ltpaiodio4.logfile -o ltpaiodio4.outfile -p -f ${TMPBASE}/ltp-aiodio.part4 &
    302 
    303 wait $!
    304 sync
    305 echo "************ End Running dio_sparse & miscellaneous tests "
    306 echo ""
    307 
    308 echo "************ Cleaning/Umounting"
    309 
    310 rm -f $TMP/aiodio/fff
    311 rm -f $TMP/aiodio/ff1
    312 rm -f $TMP/aiodio/ff2
    313 rm -f $TMP/aiodio/ff3
    314 rm -f $TMP/aiodio/junkfile*
    315 rm -f $TMP/aiodio/file*
    316 rm -rf $TMP/aiodio/junkdir
    317 
    318 umount $part1
    319 
    320 if [ "$runExtendedStress" -eq 1 ]; then
    321       umount $part2
    322 fi
    323 
    324 
    325 done
    326 date
    327 echo "AIO/DIO test complete "
    328