blob: 686e7b8851aa2dd9ef6273a4093616a2a61e13ce [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
mridgebd147532004-03-03 20:33:10 +0000132umount -f $part1
robbiew7df75e22004-12-20 20:16:43 +0000133mkdir /test > /dev/nul 2>&1
134mkdir /test/aiodio > /dev/nul 2>&1
135mkdir /test/aiodio2 > /dev/nul 2>&1
mridge79506cb2004-02-27 22:55:50 +0000136
137while [ "$runTest" -lt "$run0" ]
138do
139
140echo "runTest=$runTest run0=$run0 nextTest=$nextTest"
141
142if [ -n "$ext2" -a $nextTest -eq 0 ]; then
143 echo "***************************"
144 echo "* Testing ext2 filesystem *"
145 echo "***************************"
146 mkfs -t ext2 $part1
147 mount -t ext2 $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000148 if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
149 mkfs -t ext3 $part2
150 mount -t ext3 $part2 /test/aiodio2
151 elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
152 mkfs.jfs $part2 <testscripts/yesenter.txt
153 mount -t jfs $part2 /test/aiodio2
154 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
155 mkfs.xfs -f $part2
156 mount -t xfs $part2 /test/aiodio2
157 fi
mridge79506cb2004-02-27 22:55:50 +0000158elif [ $nextTest -eq 0 ]; then
159 nextTest=$(($nextTest+1))
160fi
161
162if [ -n "$ext3" -a $nextTest -eq 1 ]; then
163 echo "***************************"
164 echo "* Testing ext3 filesystem *"
165 echo "***************************"
166 mkfs -t ext3 $part1
167 mount -t ext3 $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000168 if [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
169 mkfs.jfs $part2 <testscripts/yesenter.txt
170 mount -t jfs $part2 /test/aiodio2
171 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
172 mkfs.xfs -f $part2
173 mount -t xfs $part2 /test/aiodio2
174 elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
175 mkfs -t ext2 $part2
176 mount -t ext2 $part2 /test/aiodio2
177 fi
mridge79506cb2004-02-27 22:55:50 +0000178elif [ $nextTest -eq 1 ]; then
179 nextTest=$(($nextTest+1))
180fi
181
182if [ -n "$jfs" -a $nextTest -eq 2 ]; then
183 echo "**************************"
184 echo "* Testing jfs filesystem *"
185 echo "**************************"
mridgebd147532004-03-03 20:33:10 +0000186 mkfs.jfs $part1 <testscripts/yesenter.txt
mridge79506cb2004-02-27 22:55:50 +0000187 mount -t jfs $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000188 if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
189 mkfs -t ext3 $part2
190 mount -t ext3 $part2 /test/aiodio2
191 elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
192 mkfs.xfs -f $part2
193 mount -t xfs $part2 /test/aiodio2
194 elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
195 mkfs -t ext2 $part2
196 mount -t ext2 $part2 /test/aiodio2
197 fi
mridge79506cb2004-02-27 22:55:50 +0000198elif [ $nextTest -eq 2 ]; then
199 nextTest=$(($nextTest+1))
200fi
201
202if [ -n "$xfs" -a $nextTest -eq 3 ]; then
203 echo "**************************"
204 echo "* Testing xfs filesystem *"
205 echo "**************************"
206 mkfs.xfs -f $part1
207 mount -t xfs $part1 /test/aiodio
mridgebd147532004-03-03 20:33:10 +0000208 if [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
209 mkfs -t ext2 $part2
210 mount -t ext2 $part2 /test/aiodio2
211 elif [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
212 mkfs -t ext3 $part2
213 mount -t ext3 $part2 /test/aiodio2
214 elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
215 mkfs.jfs $part2 <testscripts/yesenter.txt
216 mount -t jfs $part2 /test/aiodio2
217 fi
mridge79506cb2004-02-27 22:55:50 +0000218elif [ $nextTest -eq 3 ]; then
219 nextTest=$(($nextTest+1))
220fi
221
222nextTest=$(($nextTest+1))
223runTest=$(($runTest+1))
224
225mkdir /test/aiodio/junkdir
mridge7bdd88c2004-08-11 15:05:14 +0000226dd if=$file1 of=/test/aiodio/junkfile bs=8192 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000227
mridgebd147532004-03-03 20:33:10 +0000228date
mridge906ef672004-03-03 20:33:56 +0000229echo "************ Running aio-stress tests "
230echo "current working dir = ${PWD}"
231${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part1 > ${TMPBASE}/ltp-aio-stress.part1
mridge79506cb2004-02-27 22:55:50 +0000232
robbiewbbe42662004-06-28 17:58:29 +0000233${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 +0000234
mridge906ef672004-03-03 20:33:56 +0000235wait $!
mridgebd147532004-03-03 20:33:10 +0000236
mreed1067ce2882006-04-10 19:48:38 +0000237sync
238echo "************ End Running aio-stress tests "
mreed10a9298572006-04-19 21:46:38 +0000239echo ""
mreed1067ce2882006-04-10 19:48:38 +0000240
mridgebd147532004-03-03 20:33:10 +0000241if [ "$runExtendedStress" -eq 1 ];then
242echo "************ Running EXTENDED aio-stress tests "
243${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part2 > ${TMPBASE}/ltp-aio-stress.part2
244
robbiewbbe42662004-06-28 17:58:29 +0000245${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 +0000246
247wait $!
mreed1067ce2882006-04-10 19:48:38 +0000248sync
mridgebd147532004-03-03 20:33:10 +0000249fi
mridge79506cb2004-02-27 22:55:50 +0000250
mridge7bdd88c2004-08-11 15:05:14 +0000251dd if=$file1 of=/test/aiodio/junkfile bs=8192 conv=block,sync
mridged8b3dff2004-04-27 22:39:40 +0000252dd if=$file1 of=/test/aiodio/fff bs=4096 conv=block,sync
mridge7bdd88c2004-08-11 15:05:14 +0000253dd if=$file1 of=/test/aiodio/ff1 bs=2048 conv=block,sync
254dd if=$file1 of=/test/aiodio/ff2 bs=1024 conv=block,sync
255dd if=$file1 of=/test/aiodio/ff3 bs=512 conv=block,sync
mridged8b3dff2004-04-27 22:39:40 +0000256
mridge79506cb2004-02-27 22:55:50 +0000257echo "************ Running aiocp tests "
mridge79506cb2004-02-27 22:55:50 +0000258${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part1 > ${TMPBASE}/ltp-aiodio.part1
259
mreed10a9298572006-04-19 21:46:38 +0000260${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 +0000261
262wait $!
263sync
mreed1067ce2882006-04-10 19:48:38 +0000264echo "************ End Running aiocp tests "
265echo ""
mridge79506cb2004-02-27 22:55:50 +0000266
267echo "************ Running aiodio_sparse tests "
268${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part2 > ${TMPBASE}/ltp-aiodio.part2
269
robbiewbbe42662004-06-28 17:58:29 +0000270${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 +0000271
272wait $!
mreed1067ce2882006-04-10 19:48:38 +0000273sync
274echo "************ End Running aiodio_sparse tests "
275echo ""
mridge79506cb2004-02-27 22:55:50 +0000276
mridge79506cb2004-02-27 22:55:50 +0000277
mreed1067ce2882006-04-10 19:48:38 +0000278if [ "$runExtendedStress" -eq 1 ];then
279echo "************ Running fsx-linux tests "
mridge79506cb2004-02-27 22:55:50 +0000280${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part3 > ${TMPBASE}/ltp-aiodio.part3
281
mreed10a9298572006-04-19 21:46:38 +0000282${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 +0000283
284
mridge79506cb2004-02-27 22:55:50 +0000285
286wait $!
mreed1067ce2882006-04-10 19:48:38 +0000287sync
288fi
289
290dd if=$file1 of=/test/aiodio/file2 bs=2048 conv=block,sync
291dd if=$file1 of=/test/aiodio/file3 bs=1024 conv=block,sync
292dd if=$file1 of=/test/aiodio/file4 bs=512 conv=block,sync
293dd if=$file1 of=/test/aiodio/file5 bs=4096 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000294
295
mridge79506cb2004-02-27 22:55:50 +0000296
mridge79506cb2004-02-27 22:55:50 +0000297
mreed1067ce2882006-04-10 19:48:38 +0000298echo "************ Running dio_sparse & miscellaneous tests "
mreed10a9298572006-04-19 21:46:38 +0000299${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part4 > ${TMPBASE}/ltp-aiodio.part4
300${LTPROOT}/pan/pan -e -S -a ltpaiodiopart4 -n ltp-aiodiopart4 -l ltpaiodio4.logfile -o ltpaiodio4.outfile -p -f ${TMPBASE}/ltp-aiodio.part4 &
301
mreed1067ce2882006-04-10 19:48:38 +0000302wait $!
303sync
304echo "************ End Running dio_sparse & miscellaneous tests "
305echo ""
mridge79506cb2004-02-27 22:55:50 +0000306
mreed10a9298572006-04-19 21:46:38 +0000307echo "************ Cleaning/Umounting"
mridge79506cb2004-02-27 22:55:50 +0000308
309rm -f /test/aiodio/fff
310rm -f /test/aiodio/ff1
311rm -f /test/aiodio/ff2
312rm -f /test/aiodio/ff3
313rm -f /test/aiodio/junkfile*
314rm -f /test/aiodio/file*
315rm -rf /test/aiodio/junkdir
316
317umount $part1
318
319done
mridgebd147532004-03-03 20:33:10 +0000320date
mreed1067ce2882006-04-10 19:48:38 +0000321echo "AIO/DIO test complete "