blob: 81a1a41460ed984ac27c810e487c63e1fb2bba17 [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.
6#
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}
14echo $LTPROOT | grep testscripts > /dev/null 2>&1
15if [ $? -eq 0 ]; then
16 cd ..
17 export LTPROOT=${PWD}
18fi
19
20run0=0
21runTest=0
22nextTest=0
mridgebd147532004-03-03 20:33:10 +000023runExtendedStress=0
mridge79506cb2004-02-27 22:55:50 +000024
25export TMPBASE="/tmp"
26usage()
27{
28 cat <<-END >&2
mridgebd147532004-03-03 20:33:10 +000029 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 +000030
31 defaults:
32 file1=$file1
33 part1=$part1
34 ext2=0
35 ext3=0
36 jfs=0
37 xfs=0
mreed1067ce2882006-04-10 19:48:38 +000038 example: ${0##*/} -f MyLargeFile -b /dev/hdc1 [-o /dev/hdc2] [-a 1] or
39[-e 1] [-x 1] [-j 1] [-t 1]
mridgebd147532004-03-03 20:33:10 +000040 -o = optional partition allows some of the tests to utilize multiple filesystems to further stress AIO/DIO
mridge79506cb2004-02-27 22:55:50 +000041 -e = test ex2 filesystem.
42 -t = test ext3 filesystem
43 -j = test JFS filesystem
44 -x = test XFS filesystem
45 or
46 -a = test all supported filesystems, this will override any other filesystem flags passed.
47
48 - a 1 turns on the test for the above supported filesystem, just omit passing the flag to skip that filesystem.
49
50 - 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
51 but there is not a default filesystem. ReiserFS does not support AIO so these tests will not support ReiserFS.
52
53 - WARNING !! The partition you pass will be overwritten. This is a destructive test so only pass a partition where data can be destroyed.
54
55
56
57 END
58exit
59}
60
mridgebd147532004-03-03 20:33:10 +000061while getopts :a:b:e:f:t:o:x:j: arg
mridge79506cb2004-02-27 22:55:50 +000062do case $arg in
63 f) file1=$OPTARG;;
64 b) part1=$OPTARG;;
mridgebd147532004-03-03 20:33:10 +000065 o) part2=$OPTARG;;
mridge79506cb2004-02-27 22:55:50 +000066 e) ext2=$OPTARG;;
67 t) ext3=$OPTARG;;
68 x) xfs=$OPTARG;;
69 j) jfs=$OPTARG;;
70 a) allfs=$OPTARG;;
71
72 \?) echo "************** Help Info: ********************"
73 usage;;
74 esac
75done
76
77if [ ! -n "$file1" ]; then
78 echo "Missing the large file. You must pass a large filename for testing"
79 usage;
80 exit
81fi
82
83if [ ! -n "$part1" ]; then
84 echo "Missing the partition. You must pass a partition for testing"
85 usage;
86 exit
87fi
88
89if [ -n "$allfs" ]; then
90 echo "testing ALL supported filesystems"
91 ext2="1"
92 ext3="1"
93 jfs="1"
94 xfs="1"
95 echo "test run = $run0"
96fi
97
98if [ -n "$ext2" ]; then
99 echo "** testing ext2 **"
100 run0=$(($run0+1))
101fi
102
103if [ -n "$ext3" ]; then
104 echo "** testing ext3 **"
105 run0=$(($run0+1))
106fi
107
108if [ -n "$xfs" ]; then
109 echo "** testing xfs **"
110 run0=$(($run0+1))
111fi
112
113if [ -n "$jfs" ]; then
114 echo "** testing jfs **"
115 run0=$(($run0+1))
116fi
117
mridgebd147532004-03-03 20:33:10 +0000118if [ -n "$part2" -a "$run0" -gt 1 ]; then
119 echo "** Running extended stress testing **"
120 runExtendedStress=1
121elif [ -n "$part2" -a "$run0" -eq 1 ]; then
122 echo " ** You must pass at least 2 filesystems to run an extended AIO stress test **"
123 usage;
124fi
125
mridge79506cb2004-02-27 22:55:50 +0000126if [ "$run0" -eq 0 ]; then
127 echo "No filesystems passed to test"
128 echo "Please pass at least one supported filesystem or the -a 1 flag to run all "
mridgebd147532004-03-03 20:33:10 +0000129 usage;
mridge79506cb2004-02-27 22:55:50 +0000130fi
131
robbiew7df75e22004-12-20 20:16:43 +0000132mkdir /test > /dev/nul 2>&1
133mkdir /test/aiodio > /dev/nul 2>&1
134mkdir /test/aiodio2 > /dev/nul 2>&1
mridge79506cb2004-02-27 22:55:50 +0000135
136while [ "$runTest" -lt "$run0" ]
137do
138
139echo "runTest=$runTest run0=$run0 nextTest=$nextTest"
140
141if [ -n "$ext2" -a $nextTest -eq 0 ]; then
142 echo "***************************"
143 echo "* Testing ext2 filesystem *"
144 echo "***************************"
145 mkfs -t ext2 $part1
146 mount -t ext2 $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000147 if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
148 mkfs -t ext3 $part2
149 mount -t ext3 $part2 /test/aiodio2
150 elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
151 mkfs.jfs $part2 <testscripts/yesenter.txt
152 mount -t jfs $part2 /test/aiodio2
153 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
154 mkfs.xfs -f $part2
155 mount -t xfs $part2 /test/aiodio2
156 fi
mridge79506cb2004-02-27 22:55:50 +0000157elif [ $nextTest -eq 0 ]; then
158 nextTest=$(($nextTest+1))
159fi
160
161if [ -n "$ext3" -a $nextTest -eq 1 ]; then
162 echo "***************************"
163 echo "* Testing ext3 filesystem *"
164 echo "***************************"
165 mkfs -t ext3 $part1
166 mount -t ext3 $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000167 if [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
168 mkfs.jfs $part2 <testscripts/yesenter.txt
169 mount -t jfs $part2 /test/aiodio2
170 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
171 mkfs.xfs -f $part2
172 mount -t xfs $part2 /test/aiodio2
173 elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
174 mkfs -t ext2 $part2
175 mount -t ext2 $part2 /test/aiodio2
176 fi
mridge79506cb2004-02-27 22:55:50 +0000177elif [ $nextTest -eq 1 ]; then
178 nextTest=$(($nextTest+1))
179fi
180
181if [ -n "$jfs" -a $nextTest -eq 2 ]; then
182 echo "**************************"
183 echo "* Testing jfs filesystem *"
184 echo "**************************"
mridgebd147532004-03-03 20:33:10 +0000185 mkfs.jfs $part1 <testscripts/yesenter.txt
mridge79506cb2004-02-27 22:55:50 +0000186 mount -t jfs $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000187 if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
188 mkfs -t ext3 $part2
189 mount -t ext3 $part2 /test/aiodio2
190 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
191 mkfs.xfs -f $part2
192 mount -t xfs $part2 /test/aiodio2
193 elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
194 mkfs -t ext2 $part2
195 mount -t ext2 $part2 /test/aiodio2
196 fi
mridge79506cb2004-02-27 22:55:50 +0000197elif [ $nextTest -eq 2 ]; then
198 nextTest=$(($nextTest+1))
199fi
200
201if [ -n "$xfs" -a $nextTest -eq 3 ]; then
202 echo "**************************"
203 echo "* Testing xfs filesystem *"
204 echo "**************************"
205 mkfs.xfs -f $part1
206 mount -t xfs $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000207 if [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
208 mkfs -t ext2 $part2
209 mount -t ext2 $part2 /test/aiodio2
210 elif [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
211 mkfs -t ext3 $part2
212 mount -t ext3 $part2 /test/aiodio2
213 elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
214 mkfs.jfs $part2 <testscripts/yesenter.txt
215 mount -t jfs $part2 /test/aiodio2
216 fi
mridge79506cb2004-02-27 22:55:50 +0000217elif [ $nextTest -eq 3 ]; then
218 nextTest=$(($nextTest+1))
219fi
220
221nextTest=$(($nextTest+1))
222runTest=$(($runTest+1))
223
224mkdir /test/aiodio/junkdir
mridge7bdd88c2004-08-11 15:05:14 +0000225dd if=$file1 of=/test/aiodio/junkfile bs=8192 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000226
mridgebd147532004-03-03 20:33:10 +0000227date
mridge906ef672004-03-03 20:33:56 +0000228echo "************ Running aio-stress tests "
229echo "current working dir = ${PWD}"
230${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part1 > ${TMPBASE}/ltp-aio-stress.part1
mridge79506cb2004-02-27 22:55:50 +0000231
robbiewbbe42662004-06-28 17:58:29 +0000232${LTPROOT}/pan/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 +0000233
mridge906ef672004-03-03 20:33:56 +0000234wait $!
mridgebd147532004-03-03 20:33:10 +0000235
mreed1067ce2882006-04-10 19:48:38 +0000236sync
237echo "************ End Running aio-stress tests "
mreed10a9298572006-04-19 21:46:38 +0000238echo ""
mreed1067ce2882006-04-10 19:48:38 +0000239
mridgebd147532004-03-03 20:33:10 +0000240if [ "$runExtendedStress" -eq 1 ];then
241echo "************ Running EXTENDED aio-stress tests "
242${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part2 > ${TMPBASE}/ltp-aio-stress.part2
243
robbiewbbe42662004-06-28 17:58:29 +0000244${LTPROOT}/pan/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 +0000245
246wait $!
mreed1067ce2882006-04-10 19:48:38 +0000247sync
mridgebd147532004-03-03 20:33:10 +0000248fi
mridge79506cb2004-02-27 22:55:50 +0000249
mridge7bdd88c2004-08-11 15:05:14 +0000250dd if=$file1 of=/test/aiodio/junkfile bs=8192 conv=block,sync
mridged8b3dff2004-04-27 22:39:40 +0000251dd if=$file1 of=/test/aiodio/fff bs=4096 conv=block,sync
mridge7bdd88c2004-08-11 15:05:14 +0000252dd if=$file1 of=/test/aiodio/ff1 bs=2048 conv=block,sync
253dd if=$file1 of=/test/aiodio/ff2 bs=1024 conv=block,sync
254dd if=$file1 of=/test/aiodio/ff3 bs=512 conv=block,sync
mridged8b3dff2004-04-27 22:39:40 +0000255
mridge79506cb2004-02-27 22:55:50 +0000256echo "************ Running aiocp tests "
mridge79506cb2004-02-27 22:55:50 +0000257${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part1 > ${TMPBASE}/ltp-aiodio.part1
258
mreed10a9298572006-04-19 21:46:38 +0000259${LTPROOT}/pan/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 +0000260
261wait $!
262sync
mreed1067ce2882006-04-10 19:48:38 +0000263echo "************ End Running aiocp tests "
264echo ""
mridge79506cb2004-02-27 22:55:50 +0000265
266echo "************ Running aiodio_sparse tests "
267${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part2 > ${TMPBASE}/ltp-aiodio.part2
268
robbiewbbe42662004-06-28 17:58:29 +0000269${LTPROOT}/pan/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 +0000270
271wait $!
mreed1067ce2882006-04-10 19:48:38 +0000272sync
273echo "************ End Running aiodio_sparse tests "
274echo ""
mridge79506cb2004-02-27 22:55:50 +0000275
mridge79506cb2004-02-27 22:55:50 +0000276
mreed1067ce2882006-04-10 19:48:38 +0000277if [ "$runExtendedStress" -eq 1 ];then
278echo "************ Running fsx-linux tests "
mridge79506cb2004-02-27 22:55:50 +0000279${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part3 > ${TMPBASE}/ltp-aiodio.part3
280
mreed10a9298572006-04-19 21:46:38 +0000281${LTPROOT}/pan/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 +0000282
283
mridge79506cb2004-02-27 22:55:50 +0000284
285wait $!
mreed1067ce2882006-04-10 19:48:38 +0000286sync
287fi
288
289dd if=$file1 of=/test/aiodio/file2 bs=2048 conv=block,sync
290dd if=$file1 of=/test/aiodio/file3 bs=1024 conv=block,sync
291dd if=$file1 of=/test/aiodio/file4 bs=512 conv=block,sync
292dd if=$file1 of=/test/aiodio/file5 bs=4096 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000293
294
mridge79506cb2004-02-27 22:55:50 +0000295
mridge79506cb2004-02-27 22:55:50 +0000296
mreed1067ce2882006-04-10 19:48:38 +0000297echo "************ Running dio_sparse & miscellaneous tests "
mreed10a9298572006-04-19 21:46:38 +0000298${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part4 > ${TMPBASE}/ltp-aiodio.part4
299${LTPROOT}/pan/pan -e -S -a ltpaiodiopart4 -n ltp-aiodiopart4 -l ltpaiodio4.logfile -o ltpaiodio4.outfile -p -f ${TMPBASE}/ltp-aiodio.part4 &
300
mreed1067ce2882006-04-10 19:48:38 +0000301wait $!
302sync
303echo "************ End Running dio_sparse & miscellaneous tests "
304echo ""
mridge79506cb2004-02-27 22:55:50 +0000305
mreed10a9298572006-04-19 21:46:38 +0000306echo "************ Cleaning/Umounting"
mridge79506cb2004-02-27 22:55:50 +0000307
308rm -f /test/aiodio/fff
309rm -f /test/aiodio/ff1
310rm -f /test/aiodio/ff2
311rm -f /test/aiodio/ff3
312rm -f /test/aiodio/junkfile*
313rm -f /test/aiodio/file*
314rm -rf /test/aiodio/junkdir
315
316umount $part1
317
mreed10360d14b2006-09-11 21:05:39 +0000318if [ "$runExtendedStress" -eq 1 ]; then
319 umount $part2
320fi
321
322
mridge79506cb2004-02-27 22:55:50 +0000323done
mridgebd147532004-03-03 20:33:10 +0000324date
mreed1067ce2882006-04-10 19:48:38 +0000325echo "AIO/DIO test complete "