blob: 161d028d435f1421cd4e56f0c4c9fcb7a882128d [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#
9#
10
11cd `dirname $0`
12export LTPROOT=${PWD}
13echo $LTPROOT | grep testscripts > /dev/null 2>&1
14if [ $? -eq 0 ]; then
15 cd ..
16 export LTPROOT=${PWD}
17fi
18
19run0=0
20runTest=0
21nextTest=0
mridgebd147532004-03-03 20:33:10 +000022runExtendedStress=0
mridge79506cb2004-02-27 22:55:50 +000023
24export TMPBASE="/tmp"
25usage()
26{
27 cat <<-END >&2
mridgebd147532004-03-03 20:33:10 +000028 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 +000029
30 defaults:
31 file1=$file1
32 part1=$part1
33 ext2=0
34 ext3=0
35 jfs=0
36 xfs=0
mreed1067ce2882006-04-10 19:48:38 +000037 example: ${0##*/} -f MyLargeFile -b /dev/hdc1 [-o /dev/hdc2] [-a 1] or
38[-e 1] [-x 1] [-j 1] [-t 1]
mridgebd147532004-03-03 20:33:10 +000039 -o = optional partition allows some of the tests to utilize multiple filesystems to further stress AIO/DIO
mridge79506cb2004-02-27 22:55:50 +000040 -e = test ex2 filesystem.
41 -t = test ext3 filesystem
42 -j = test JFS filesystem
43 -x = test XFS filesystem
44 or
45 -a = test all supported filesystems, this will override any other filesystem flags passed.
46
47 - a 1 turns on the test for the above supported filesystem, just omit passing the flag to skip that filesystem.
48
49 - 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
50 but there is not a default filesystem. ReiserFS does not support AIO so these tests will not support ReiserFS.
51
52 - WARNING !! The partition you pass will be overwritten. This is a destructive test so only pass a partition where data can be destroyed.
53
54
55
56 END
57exit
58}
59
mridgebd147532004-03-03 20:33:10 +000060while getopts :a:b:e:f:t:o:x:j: arg
mridge79506cb2004-02-27 22:55:50 +000061do case $arg in
62 f) file1=$OPTARG;;
63 b) part1=$OPTARG;;
mridgebd147532004-03-03 20:33:10 +000064 o) part2=$OPTARG;;
mridge79506cb2004-02-27 22:55:50 +000065 e) ext2=$OPTARG;;
66 t) ext3=$OPTARG;;
67 x) xfs=$OPTARG;;
68 j) jfs=$OPTARG;;
69 a) allfs=$OPTARG;;
70
71 \?) echo "************** Help Info: ********************"
72 usage;;
73 esac
74done
75
76if [ ! -n "$file1" ]; then
77 echo "Missing the large file. You must pass a large filename for testing"
78 usage;
79 exit
80fi
81
82if [ ! -n "$part1" ]; then
83 echo "Missing the partition. You must pass a partition for testing"
84 usage;
85 exit
86fi
87
88if [ -n "$allfs" ]; then
89 echo "testing ALL supported filesystems"
90 ext2="1"
91 ext3="1"
92 jfs="1"
93 xfs="1"
94 echo "test run = $run0"
95fi
96
97if [ -n "$ext2" ]; then
98 echo "** testing ext2 **"
99 run0=$(($run0+1))
100fi
101
102if [ -n "$ext3" ]; then
103 echo "** testing ext3 **"
104 run0=$(($run0+1))
105fi
106
107if [ -n "$xfs" ]; then
108 echo "** testing xfs **"
109 run0=$(($run0+1))
110fi
111
112if [ -n "$jfs" ]; then
113 echo "** testing jfs **"
114 run0=$(($run0+1))
115fi
116
mridgebd147532004-03-03 20:33:10 +0000117if [ -n "$part2" -a "$run0" -gt 1 ]; then
118 echo "** Running extended stress testing **"
119 runExtendedStress=1
120elif [ -n "$part2" -a "$run0" -eq 1 ]; then
121 echo " ** You must pass at least 2 filesystems to run an extended AIO stress test **"
122 usage;
123fi
124
mridge79506cb2004-02-27 22:55:50 +0000125if [ "$run0" -eq 0 ]; then
126 echo "No filesystems passed to test"
127 echo "Please pass at least one supported filesystem or the -a 1 flag to run all "
mridgebd147532004-03-03 20:33:10 +0000128 usage;
mridge79506cb2004-02-27 22:55:50 +0000129fi
130
mridgebd147532004-03-03 20:33:10 +0000131umount -f $part1
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 "
238echo "
239
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
mreed1067ce2882006-04-10 19:48:38 +0000259${LTPROOT}/pan/pan -e -S -a ltpaiodiopart1 -n ltp-aiodiopart1 -l
260ltpaiodio1.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
mreed1067ce2882006-04-10 19:48:38 +0000282${LTPROOT}/pan/pan -e -S -a ltpaiodiopart3 -n ltp-aiodiopart3 -l
283ltpaiodio3.logfile -o ltpaiodio3.outfile -p -f ${TMPBASE}/ltp-aiodio.part3 &
284
285
mridge79506cb2004-02-27 22:55:50 +0000286
287wait $!
mreed1067ce2882006-04-10 19:48:38 +0000288sync
289fi
290
291dd if=$file1 of=/test/aiodio/file2 bs=2048 conv=block,sync
292dd if=$file1 of=/test/aiodio/file3 bs=1024 conv=block,sync
293dd if=$file1 of=/test/aiodio/file4 bs=512 conv=block,sync
294dd if=$file1 of=/test/aiodio/file5 bs=4096 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000295
296
mridge79506cb2004-02-27 22:55:50 +0000297
mridge79506cb2004-02-27 22:55:50 +0000298
mreed1067ce2882006-04-10 19:48:38 +0000299echo "************ Running dio_sparse & miscellaneous tests "
300${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part4 >
301${TMPBASE}/ltp-aiodio.part4
302${LTPROOT}/pan/pan -e -S -a ltpaiodiopart4 -n ltp-aiodiopart4 -l
303ltpaiodio4.logfile -o ltpaiodio4.outfile -p -f ${TMPBASE}/ltp-aiodio.part4 &
304wait $!
305sync
306echo "************ End Running dio_sparse & miscellaneous tests "
307echo ""
mridge79506cb2004-02-27 22:55:50 +0000308
mreed1067ce2882006-04-10 19:48:38 +0000309echo "************ Cleaning/Umounting
mridge79506cb2004-02-27 22:55:50 +0000310
311rm -f /test/aiodio/fff
312rm -f /test/aiodio/ff1
313rm -f /test/aiodio/ff2
314rm -f /test/aiodio/ff3
315rm -f /test/aiodio/junkfile*
316rm -f /test/aiodio/file*
317rm -rf /test/aiodio/junkdir
318
319umount $part1
320
321done
mridgebd147532004-03-03 20:33:10 +0000322date
mreed1067ce2882006-04-10 19:48:38 +0000323echo "AIO/DIO test complete "