blob: c6fdfb75643e49c27ada493f34486eac418e9f12 [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
37
mridgebd147532004-03-03 20:33:10 +000038 example: ${0##*/} -f MyLargeFile -b /dev/hdc1 [-o /dev/hdc2] [-a 1] or [-e 1] [-x 1] [-j 1] [-s 1]
39 -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
mridge79506cb2004-02-27 22:55:50 +0000132mkdir /test 2&>1 > /dev/nul
133mkdir /test/aiodio 2&>1 > /dev/nul
mridgebd147532004-03-03 20:33:10 +0000134mkdir /test/aiodio2 2&>1 > /dev/nul
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
225cp $file1 /test/aiodio/junkfile
226cp $file1 /test/aiodio/fff
227cp $file1 /test/aiodio/ff1
228cp $file1 /test/aiodio/ff2
229cp $file1 /test/aiodio/ff3
230
mridgebd147532004-03-03 20:33:10 +0000231date
232#echo "************ Running aio-stress tests "
233#echo "current working dir = ${PWD}"
234#${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part1 > ${TMPBASE}/ltp-aio-stress.part1
mridge79506cb2004-02-27 22:55:50 +0000235
mridgebd147532004-03-03 20:33:10 +0000236#${LTPROOT}/pan/pan -e -S -a ltpaiostresspart1 -n ltp-aiostresspart1 -l ltpaiostress.logfile -f ${TMPBASE}/ltp-aio-stress.part1 &
237
238#wait $!
239
240if [ "$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
244${LTPROOT}/pan/pan -e -S -a ltpaiostresspart2 -n ltp-aiostresspart2 -l ltpaiostress.logfile -f ${TMPBASE}/ltp-aio-stress.part2 &
245
246wait $!
247fi
mridge79506cb2004-02-27 22:55:50 +0000248
249echo "************ Running aiocp tests "
mridge79506cb2004-02-27 22:55:50 +0000250${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part1 > ${TMPBASE}/ltp-aiodio.part1
251
252${LTPROOT}/pan/pan -e -S -a ltpaiodiopart1 -n ltp-aiodiopart1 -l ltpaiodio.logfile -f ${TMPBASE}/ltp-aiodio.part1 &
253
254wait $!
255sync
256
257echo "************ Running aiodio_sparse tests "
258${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part2 > ${TMPBASE}/ltp-aiodio.part2
259
260${LTPROOT}/pan/pan -e -S -a ltpaiodiopart2 -n ltp-aiodiopart2 -l ltpaiodio2.logfile -f ${TMPBASE}/ltp-aiodio.part2 &
261
262wait $!
263
mridge79506cb2004-02-27 22:55:50 +0000264
265echo "************ Running aiodio_sparse tests "
266${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part3 > ${TMPBASE}/ltp-aiodio.part3
267
268${LTPROOT}/pan/pan -x 5 -e -S -a ltpaiodiopart3 -n ltp-aiodiopart3 -l ltpaiodio3.logfile -f ${TMPBASE}/ltp-aiodio.part3 &
269
270wait $!
271
272
273#!/bin/bash
274
275LIMIT=10
276
277
278echo "Running dio_sparse"
279
280var0=1
281while [ "$var0" -lt "$LIMIT" ]
282do
283echo -n "$var0 iteration on dio_sparse"
mridgebd147532004-03-03 20:33:10 +0000284 testcases/kernel/io/ltp-aiodio/dirty
285 testcases/kernel/io/ltp-aiodio/dio_sparse
mridge79506cb2004-02-27 22:55:50 +0000286 date
287 var0=$(($var0+1))
288done
289
290var0=1
291while [ "$var0" -lt "$LIMIT" ]
292do
293echo -n "$var0 iteration on dio_sparse"
mridgebd147532004-03-03 20:33:10 +0000294 testcases/kernel/io/ltp-aiodio/dio_sparse
mridge79506cb2004-02-27 22:55:50 +0000295 date
296 var0=$(($var0+1))
297done
298
299echo "Running aiodio_append"
300var0=1
301while [ "$var0" -lt "$LIMIT" ]
302do
mridgebd147532004-03-03 20:33:10 +0000303 testcases/kernel/io/ltp-aiodio/aiodio_append
mridge79506cb2004-02-27 22:55:50 +0000304 date
305 var0=$(($var0+1))
306done
307
308echo "Running dio_append"
309var0=1
310while [ "$var0" -lt "$LIMIT" ]
311do
mridgebd147532004-03-03 20:33:10 +0000312testcases/kernel/io/ltp-aiodio/dio_append
mridge79506cb2004-02-27 22:55:50 +0000313date
314 var0=$(($var0+1))
315done
316
317#echo "Running dio_truncate"
318#var0=1
319#while [ "$var0" -lt "$LIMIT" ]
320#do
mridgebd147532004-03-03 20:33:10 +0000321#testcases/kernel/io/ltp-aiodio/dio_truncate
mridge79506cb2004-02-27 22:55:50 +0000322#date
323# var0=$(($var0+1))
324#done
325
326echo "Running read_checkzero"
327var0=1
328while [ "$var0" -lt "$LIMIT" ]
329do
mridgebd147532004-03-03 20:33:10 +0000330testcases/kernel/io/ltp-aiodio/read_checkzero
mridge79506cb2004-02-27 22:55:50 +0000331date
332 var0=$(($var0+1))
333done
334
335echo "Running ltp-diorh"
336var0=1
337while [ "$var0" -lt "$LIMIT" ]
338do
mridgebd147532004-03-03 20:33:10 +0000339testcases/kernel/io/ltp-aiodio/ltp-diorh /test/aiodio/file
mridge79506cb2004-02-27 22:55:50 +0000340date
341 var0=$(($var0+1))
342done
343
344
345rm -f /test/aiodio/fff
346rm -f /test/aiodio/ff1
347rm -f /test/aiodio/ff2
348rm -f /test/aiodio/ff3
349rm -f /test/aiodio/junkfile*
350rm -f /test/aiodio/file*
351rm -rf /test/aiodio/junkdir
352
353umount $part1
354
355done
mridgebd147532004-03-03 20:33:10 +0000356date
mridge79506cb2004-02-27 22:55:50 +0000357echo "AIO/DIO test complete " date