blob: d9b67837650213307324af026b728a6d94303db6 [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
mridged7cec1c2004-04-27 19:45:03 +0000225dd if=$file1 of=/test/aiodio/junkfile bs=4096 conv=block,sync
226dd if=$file1 of=/test/aiodio/fff bs=4096 conv=block,sync
227dd if=$file1 of=/test/aiodio/ff1 bs=4096 conv=block,sync
228dd if=$file1 of=/test/aiodio/ff2 bs=4096 conv=block,sync
229dd if=$file1 of=/test/aiodio/ff3 bs=4096 conv=block,sync
mridge79506cb2004-02-27 22:55:50 +0000230
mridgebd147532004-03-03 20:33:10 +0000231date
mridge906ef672004-03-03 20:33:56 +0000232echo "************ Running aio-stress tests "
233echo "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
mridge906ef672004-03-03 20:33:56 +0000236${LTPROOT}/pan/pan -e -S -a ltpaiostresspart1 -n ltp-aiostresspart1 -l ltpaiostress.logfile -f ${TMPBASE}/ltp-aio-stress.part1 &
mridgebd147532004-03-03 20:33:10 +0000237
mridge906ef672004-03-03 20:33:56 +0000238wait $!
mridgebd147532004-03-03 20:33:10 +0000239
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
mridged8b3dff2004-04-27 22:39:40 +0000249dd if=$file1 of=/test/aiodio/junkfile bs=4096 conv=block,sync
250dd if=$file1 of=/test/aiodio/fff bs=4096 conv=block,sync
251dd if=$file1 of=/test/aiodio/ff1 bs=4096 conv=block,sync
252dd if=$file1 of=/test/aiodio/ff2 bs=4096 conv=block,sync
253dd if=$file1 of=/test/aiodio/ff3 bs=4096 conv=block,sync
254
mridge79506cb2004-02-27 22:55:50 +0000255echo "************ Running aiocp tests "
mridge79506cb2004-02-27 22:55:50 +0000256${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part1 > ${TMPBASE}/ltp-aiodio.part1
257
258${LTPROOT}/pan/pan -e -S -a ltpaiodiopart1 -n ltp-aiodiopart1 -l ltpaiodio.logfile -f ${TMPBASE}/ltp-aiodio.part1 &
259
260wait $!
261sync
262
263echo "************ Running aiodio_sparse tests "
264${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part2 > ${TMPBASE}/ltp-aiodio.part2
265
266${LTPROOT}/pan/pan -e -S -a ltpaiodiopart2 -n ltp-aiodiopart2 -l ltpaiodio2.logfile -f ${TMPBASE}/ltp-aiodio.part2 &
267
268wait $!
269
mridge79506cb2004-02-27 22:55:50 +0000270
271echo "************ Running aiodio_sparse tests "
272${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part3 > ${TMPBASE}/ltp-aiodio.part3
273
274${LTPROOT}/pan/pan -x 5 -e -S -a ltpaiodiopart3 -n ltp-aiodiopart3 -l ltpaiodio3.logfile -f ${TMPBASE}/ltp-aiodio.part3 &
275
276wait $!
277
278
279#!/bin/bash
280
281LIMIT=10
282
283
284echo "Running dio_sparse"
285
286var0=1
287while [ "$var0" -lt "$LIMIT" ]
288do
289echo -n "$var0 iteration on dio_sparse"
mridgebd147532004-03-03 20:33:10 +0000290 testcases/kernel/io/ltp-aiodio/dirty
291 testcases/kernel/io/ltp-aiodio/dio_sparse
mridge79506cb2004-02-27 22:55:50 +0000292 date
293 var0=$(($var0+1))
294done
295
296var0=1
297while [ "$var0" -lt "$LIMIT" ]
298do
299echo -n "$var0 iteration on dio_sparse"
mridgebd147532004-03-03 20:33:10 +0000300 testcases/kernel/io/ltp-aiodio/dio_sparse
mridge79506cb2004-02-27 22:55:50 +0000301 date
302 var0=$(($var0+1))
303done
304
305echo "Running aiodio_append"
306var0=1
307while [ "$var0" -lt "$LIMIT" ]
308do
mridgeea43f3a2004-04-22 14:35:57 +0000309 testcases/kernel/io/ltp-aiodio/aiodio_append /test/aiodio/file2
mridge79506cb2004-02-27 22:55:50 +0000310 date
311 var0=$(($var0+1))
312done
313
314echo "Running dio_append"
315var0=1
316while [ "$var0" -lt "$LIMIT" ]
317do
mridgebd147532004-03-03 20:33:10 +0000318testcases/kernel/io/ltp-aiodio/dio_append
mridge79506cb2004-02-27 22:55:50 +0000319date
320 var0=$(($var0+1))
321done
322
323#echo "Running dio_truncate"
324#var0=1
325#while [ "$var0" -lt "$LIMIT" ]
326#do
mridgebd147532004-03-03 20:33:10 +0000327#testcases/kernel/io/ltp-aiodio/dio_truncate
mridge79506cb2004-02-27 22:55:50 +0000328#date
329# var0=$(($var0+1))
330#done
331
mridgeea43f3a2004-04-22 14:35:57 +0000332#echo "Running read_checkzero"
333#var0=1
334#while [ "$var0" -lt "$LIMIT" ]
335#do
336#testcases/kernel/io/ltp-aiodio/read_checkzero
337#date
338# var0=$(($var0+1))
339#done
mridge79506cb2004-02-27 22:55:50 +0000340
341echo "Running ltp-diorh"
mridged7cec1c2004-04-27 19:45:03 +0000342var0=1
343while [ "$var0" -lt "$LIMIT" ]
344do
345testcases/kernel/io/ltp-aiodio/ltp-diorh /test/aiodio/file
346testcases/kernel/io/ltp-aiodio/ltp-diorh /test/aiodio/file2
mridge79506cb2004-02-27 22:55:50 +0000347date
mridged7cec1c2004-04-27 19:45:03 +0000348 var0=$(($var0+1))
349done
mridge79506cb2004-02-27 22:55:50 +0000350
351
352rm -f /test/aiodio/fff
353rm -f /test/aiodio/ff1
354rm -f /test/aiodio/ff2
355rm -f /test/aiodio/ff3
356rm -f /test/aiodio/junkfile*
357rm -f /test/aiodio/file*
358rm -rf /test/aiodio/junkdir
359
360umount $part1
361
362done
mridgebd147532004-03-03 20:33:10 +0000363date
mridge79506cb2004-02-27 22:55:50 +0000364echo "AIO/DIO test complete " date