blob: 2bd5dbf81d9bc310b7fcfcf19496126b016f12c6 [file] [log] [blame]
mridge79506cb2004-02-27 22:55:50 +00001#!/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.
Chris Dearman37550cf2012-10-17 19:54:01 -07006#
7# 02/08/04 mridge@us.ibm.com
8#
mreed10a9298572006-04-19 21:46:38 +00009# 04/12/06 a Forth scenerio file has been added ltp-aiodio.part4
10#
mridge79506cb2004-02-27 22:55:50 +000011
12cd `dirname $0`
13export LTPROOT=${PWD}
Garrett Cooperc362a1a2010-09-10 09:05:02 -070014echo $LTPROOT | grep testscripts > /dev/null 2>&1
mridge79506cb2004-02-27 22:55:50 +000015if [ $? -eq 0 ]; then
16 cd ..
17 export LTPROOT=${PWD}
18fi
Garrett Cooper10c2d5e2010-09-10 09:02:47 -070019export PATH=$LTPROOT/testcases/bin:$PATH
Garrett Coopercc5f6b72010-09-10 09:00:00 -070020export TMP=${TMP:=/tmp}
mridge79506cb2004-02-27 22:55:50 +000021
22run0=0
23runTest=0
24nextTest=0
mridgebd147532004-03-03 20:33:10 +000025runExtendedStress=0
mridge79506cb2004-02-27 22:55:50 +000026
27export TMPBASE="/tmp"
Chris Dearman37550cf2012-10-17 19:54:01 -070028usage()
mridge79506cb2004-02-27 22:55:50 +000029{
30 cat <<-END >&2
mridgebd147532004-03-03 20:33:10 +000031 usage: ${0##*/} [ -f large_filename -b partition] [-o optional partition] [-e 1] [-t 1] [-j 1] [-x 1] or [-a 1]
mridge79506cb2004-02-27 22:55:50 +000032
33 defaults:
34 file1=$file1
35 part1=$part1
36 ext2=0
37 ext3=0
38 jfs=0
39 xfs=0
mreed1067ce2882006-04-10 19:48:38 +000040 example: ${0##*/} -f MyLargeFile -b /dev/hdc1 [-o /dev/hdc2] [-a 1] or
41[-e 1] [-x 1] [-j 1] [-t 1]
mridgebd147532004-03-03 20:33:10 +000042 -o = optional partition allows some of the tests to utilize multiple filesystems to further stress AIO/DIO
mridge79506cb2004-02-27 22:55:50 +000043 -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.
Chris Dearman37550cf2012-10-17 19:54:01 -070056
57
mridge79506cb2004-02-27 22:55:50 +000058
59 END
60exit
61}
62
mridgebd147532004-03-03 20:33:10 +000063while getopts :a:b:e:f:t:o:x:j: arg
mridge79506cb2004-02-27 22:55:50 +000064do case $arg in
65 f) file1=$OPTARG;;
66 b) part1=$OPTARG;;
mridgebd147532004-03-03 20:33:10 +000067 o) part2=$OPTARG;;
mridge79506cb2004-02-27 22:55:50 +000068 e) ext2=$OPTARG;;
69 t) ext3=$OPTARG;;
70 x) xfs=$OPTARG;;
71 j) jfs=$OPTARG;;
72 a) allfs=$OPTARG;;
Chris Dearman37550cf2012-10-17 19:54:01 -070073
mridge79506cb2004-02-27 22:55:50 +000074 \?) echo "************** Help Info: ********************"
75 usage;;
76 esac
77done
78
79if [ ! -n "$file1" ]; then
80 echo "Missing the large file. You must pass a large filename for testing"
81 usage;
82 exit
83fi
84
85if [ ! -n "$part1" ]; then
86 echo "Missing the partition. You must pass a partition for testing"
87 usage;
88 exit
89fi
90
91if [ -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"
98fi
99
100if [ -n "$ext2" ]; then
101 echo "** testing ext2 **"
102 run0=$(($run0+1))
103fi
104
105if [ -n "$ext3" ]; then
106 echo "** testing ext3 **"
107 run0=$(($run0+1))
108fi
109
110if [ -n "$xfs" ]; then
111 echo "** testing xfs **"
112 run0=$(($run0+1))
113fi
114
115if [ -n "$jfs" ]; then
116 echo "** testing jfs **"
117 run0=$(($run0+1))
118fi
119
mridgebd147532004-03-03 20:33:10 +0000120if [ -n "$part2" -a "$run0" -gt 1 ]; then
121 echo "** Running extended stress testing **"
122 runExtendedStress=1
123elif [ -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;
126fi
127
mridge79506cb2004-02-27 22:55:50 +0000128if [ "$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 "
mridgebd147532004-03-03 20:33:10 +0000131 usage;
mridge79506cb2004-02-27 22:55:50 +0000132fi
133
Chris Dearman37550cf2012-10-17 19:54:01 -0700134mkdir $TMP > /dev/null 2>&1
135mkdir $TMP/aiodio > /dev/null 2>&1
136mkdir $TMP/aiodio2 > /dev/null 2>&1
mridge79506cb2004-02-27 22:55:50 +0000137
138while [ "$runTest" -lt "$run0" ]
139do
140
141echo "runTest=$runTest run0=$run0 nextTest=$nextTest"
142
143if [ -n "$ext2" -a $nextTest -eq 0 ]; then
144 echo "***************************"
Chris Dearman37550cf2012-10-17 19:54:01 -0700145 echo "* Testing ext2 filesystem *"
mridge79506cb2004-02-27 22:55:50 +0000146 echo "***************************"
147 mkfs -t ext2 $part1
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700148 mount -t ext2 $part1 $TMP/aiodio
mridgebd147532004-03-03 20:33:10 +0000149 if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
150 mkfs -t ext3 $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700151 mount -t ext3 $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000152 elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
153 mkfs.jfs $part2 <testscripts/yesenter.txt
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700154 mount -t jfs $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000155 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
156 mkfs.xfs -f $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700157 mount -t xfs $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000158 fi
mridge79506cb2004-02-27 22:55:50 +0000159elif [ $nextTest -eq 0 ]; then
160 nextTest=$(($nextTest+1))
161fi
162
163if [ -n "$ext3" -a $nextTest -eq 1 ]; then
164 echo "***************************"
165 echo "* Testing ext3 filesystem *"
166 echo "***************************"
167 mkfs -t ext3 $part1
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700168 mount -t ext3 $part1 $TMP/aiodio
mridgebd147532004-03-03 20:33:10 +0000169 if [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
170 mkfs.jfs $part2 <testscripts/yesenter.txt
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700171 mount -t jfs $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000172 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
173 mkfs.xfs -f $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700174 mount -t xfs $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000175 elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
176 mkfs -t ext2 $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700177 mount -t ext2 $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000178 fi
mridge79506cb2004-02-27 22:55:50 +0000179elif [ $nextTest -eq 1 ]; then
180 nextTest=$(($nextTest+1))
181fi
182
183if [ -n "$jfs" -a $nextTest -eq 2 ]; then
184 echo "**************************"
185 echo "* Testing jfs filesystem *"
186 echo "**************************"
mridgebd147532004-03-03 20:33:10 +0000187 mkfs.jfs $part1 <testscripts/yesenter.txt
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700188 mount -t jfs $part1 $TMP/aiodio
mridgebd147532004-03-03 20:33:10 +0000189 if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
190 mkfs -t ext3 $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700191 mount -t ext3 $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000192 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
193 mkfs.xfs -f $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700194 mount -t xfs $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000195 elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
196 mkfs -t ext2 $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700197 mount -t ext2 $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000198 fi
mridge79506cb2004-02-27 22:55:50 +0000199elif [ $nextTest -eq 2 ]; then
200 nextTest=$(($nextTest+1))
201fi
202
203if [ -n "$xfs" -a $nextTest -eq 3 ]; then
204 echo "**************************"
205 echo "* Testing xfs filesystem *"
206 echo "**************************"
207 mkfs.xfs -f $part1
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700208 mount -t xfs $part1 $TMP/aiodio
mridgebd147532004-03-03 20:33:10 +0000209 if [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
210 mkfs -t ext2 $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700211 mount -t ext2 $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000212 elif [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
213 mkfs -t ext3 $part2
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700214 mount -t ext3 $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000215 elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
216 mkfs.jfs $part2 <testscripts/yesenter.txt
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700217 mount -t jfs $part2 $TMP/aiodio2
mridgebd147532004-03-03 20:33:10 +0000218 fi
mridge79506cb2004-02-27 22:55:50 +0000219elif [ $nextTest -eq 3 ]; then
220 nextTest=$(($nextTest+1))
221fi
222
223nextTest=$(($nextTest+1))
224runTest=$(($runTest+1))
225
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700226mkdir $TMP/aiodio/junkdir
227dd if=$file1 of=$TMP/aiodio/junkfile bs=8192 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000228
mridgebd147532004-03-03 20:33:10 +0000229date
Chris Dearman37550cf2012-10-17 19:54:01 -0700230echo "************ Running aio-stress tests "
mridge906ef672004-03-03 20:33:56 +0000231echo "current working dir = ${PWD}"
yaberauneyad8f1f5d2010-01-28 15:46:58 +0000232${LTPROOT}/bin/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part1 > ${TMPBASE}/ltp-aio-stress.part1
mridge79506cb2004-02-27 22:55:50 +0000233
root02f8fe82010-02-19 09:42:56 -0800234${LTPROOT}/bin/ltp-pan -e -S -a ltpaiostresspart1 -n ltp-aiostresspart1 -l ltpaiostress.logfile -o ltpaiostress.outfile -p -f ${TMPBASE}/ltp-aio-stress.part1 &
mridgebd147532004-03-03 20:33:10 +0000235
mridge906ef672004-03-03 20:33:56 +0000236wait $!
mridgebd147532004-03-03 20:33:10 +0000237
mreed1067ce2882006-04-10 19:48:38 +0000238sync
239echo "************ End Running aio-stress tests "
mreed10a9298572006-04-19 21:46:38 +0000240echo ""
mreed1067ce2882006-04-10 19:48:38 +0000241
mridgebd147532004-03-03 20:33:10 +0000242if [ "$runExtendedStress" -eq 1 ];then
Chris Dearman37550cf2012-10-17 19:54:01 -0700243echo "************ Running EXTENDED aio-stress tests "
yaberauneyad8f1f5d2010-01-28 15:46:58 +0000244${LTPROOT}/bin/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part2 > ${TMPBASE}/ltp-aio-stress.part2
mridgebd147532004-03-03 20:33:10 +0000245
root02f8fe82010-02-19 09:42:56 -0800246${LTPROOT}/bin/ltp-pan -e -S -a ltpaiostresspart2 -n ltp-aiostresspart2 -l ltpaiostress.logfile -o ltpaiostress.outfile -p -f ${TMPBASE}/ltp-aio-stress.part2 &
mridgebd147532004-03-03 20:33:10 +0000247
248wait $!
mreed1067ce2882006-04-10 19:48:38 +0000249sync
mridgebd147532004-03-03 20:33:10 +0000250fi
mridge79506cb2004-02-27 22:55:50 +0000251
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700252dd if=$file1 of=$TMP/aiodio/junkfile bs=8192 conv=block,sync
253dd if=$file1 of=$TMP/aiodio/fff bs=4096 conv=block,sync
254dd if=$file1 of=$TMP/aiodio/ff1 bs=2048 conv=block,sync
255dd if=$file1 of=$TMP/aiodio/ff2 bs=1024 conv=block,sync
256dd if=$file1 of=$TMP/aiodio/ff3 bs=512 conv=block,sync
mridged8b3dff2004-04-27 22:39:40 +0000257
Chris Dearman37550cf2012-10-17 19:54:01 -0700258echo "************ Running aiocp tests "
yaberauneyad8f1f5d2010-01-28 15:46:58 +0000259${LTPROOT}/bin/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part1 > ${TMPBASE}/ltp-aiodio.part1
mridge79506cb2004-02-27 22:55:50 +0000260
root02f8fe82010-02-19 09:42:56 -0800261${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart1 -n ltp-aiodiopart1 -l ltpaiodio1.logfile -o ltpaiodio1.outfile -p -f ${TMPBASE}/ltp-aiodio.part1 &
mridge79506cb2004-02-27 22:55:50 +0000262
263wait $!
264sync
mreed1067ce2882006-04-10 19:48:38 +0000265echo "************ End Running aiocp tests "
266echo ""
mridge79506cb2004-02-27 22:55:50 +0000267
Chris Dearman37550cf2012-10-17 19:54:01 -0700268echo "************ Running aiodio_sparse tests "
yaberauneyad8f1f5d2010-01-28 15:46:58 +0000269${LTPROOT}/bin/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part2 > ${TMPBASE}/ltp-aiodio.part2
mridge79506cb2004-02-27 22:55:50 +0000270
root02f8fe82010-02-19 09:42:56 -0800271${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart2 -n ltp-aiodiopart2 -l ltpaiodio2.logfile -o ltpaiodio2.outfile -p -f ${TMPBASE}/ltp-aiodio.part2 &
mridge79506cb2004-02-27 22:55:50 +0000272
273wait $!
mreed1067ce2882006-04-10 19:48:38 +0000274sync
275echo "************ End Running aiodio_sparse tests "
276echo ""
mridge79506cb2004-02-27 22:55:50 +0000277
mridge79506cb2004-02-27 22:55:50 +0000278
mreed1067ce2882006-04-10 19:48:38 +0000279if [ "$runExtendedStress" -eq 1 ];then
280echo "************ Running fsx-linux tests "
yaberauneyad8f1f5d2010-01-28 15:46:58 +0000281${LTPROOT}/bin/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part3 > ${TMPBASE}/ltp-aiodio.part3
mridge79506cb2004-02-27 22:55:50 +0000282
root02f8fe82010-02-19 09:42:56 -0800283${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart3 -n ltp-aiodiopart3 -l ltpaiodio3.logfile -o ltpaiodio3.outfile -p -f ${TMPBASE}/ltp-aiodio.part3 &
mreed1067ce2882006-04-10 19:48:38 +0000284
285
mridge79506cb2004-02-27 22:55:50 +0000286
287wait $!
mreed1067ce2882006-04-10 19:48:38 +0000288sync
289fi
290
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700291dd if=$file1 of=$TMP/aiodio/file2 bs=2048 conv=block,sync
292dd if=$file1 of=$TMP/aiodio/file3 bs=1024 conv=block,sync
293dd if=$file1 of=$TMP/aiodio/file4 bs=512 conv=block,sync
294dd if=$file1 of=$TMP/aiodio/file5 bs=4096 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000295
296
mridge79506cb2004-02-27 22:55:50 +0000297
Chris Dearman37550cf2012-10-17 19:54:01 -0700298
mreed1067ce2882006-04-10 19:48:38 +0000299echo "************ Running dio_sparse & miscellaneous tests "
yaberauneyad8f1f5d2010-01-28 15:46:58 +0000300${LTPROOT}/bin/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part4 > ${TMPBASE}/ltp-aiodio.part4
root02f8fe82010-02-19 09:42:56 -0800301${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart4 -n ltp-aiodiopart4 -l ltpaiodio4.logfile -o ltpaiodio4.outfile -p -f ${TMPBASE}/ltp-aiodio.part4 &
mreed10a9298572006-04-19 21:46:38 +0000302
mreed1067ce2882006-04-10 19:48:38 +0000303wait $!
304sync
305echo "************ End Running dio_sparse & miscellaneous tests "
306echo ""
mridge79506cb2004-02-27 22:55:50 +0000307
Chris Dearman37550cf2012-10-17 19:54:01 -0700308echo "************ Cleaning/Umounting"
mridge79506cb2004-02-27 22:55:50 +0000309
Garrett Coopercc5f6b72010-09-10 09:00:00 -0700310rm -f $TMP/aiodio/fff
311rm -f $TMP/aiodio/ff1
312rm -f $TMP/aiodio/ff2
313rm -f $TMP/aiodio/ff3
314rm -f $TMP/aiodio/junkfile*
315rm -f $TMP/aiodio/file*
316rm -rf $TMP/aiodio/junkdir
mridge79506cb2004-02-27 22:55:50 +0000317
318umount $part1
319
mreed10360d14b2006-09-11 21:05:39 +0000320if [ "$runExtendedStress" -eq 1 ]; then
321 umount $part2
322fi
323
324
mridge79506cb2004-02-27 22:55:50 +0000325done
mridgebd147532004-03-03 20:33:10 +0000326date
mreed1067ce2882006-04-10 19:48:38 +0000327echo "AIO/DIO test complete "