blob: 44166dbf2edcea6ebbf81b89fb135b8c4b3f85bb [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
22
23export TMPBASE="/tmp"
24usage()
25{
26 cat <<-END >&2
27 usage: ${0##*/} [ -f large_filename -b partition] [-e 1] [-t 1] [-j 1] [-x 1] or [-a 1]
28
29 defaults:
30 file1=$file1
31 part1=$part1
32 ext2=0
33 ext3=0
34 jfs=0
35 xfs=0
36
37 example: ${0##*/} -f MyLargeFile -b /dev/hdc1 [-a 1] or [-e 1] [-x 1] [-j 1] [-s 1]
38 -e = test ex2 filesystem.
39 -t = test ext3 filesystem
40 -j = test JFS filesystem
41 -x = test XFS filesystem
42 or
43 -a = test all supported filesystems, this will override any other filesystem flags passed.
44
45 - a 1 turns on the test for the above supported filesystem, just omit passing the flag to skip that filesystem.
46
47 - 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
48 but there is not a default filesystem. ReiserFS does not support AIO so these tests will not support ReiserFS.
49
50 - WARNING !! The partition you pass will be overwritten. This is a destructive test so only pass a partition where data can be destroyed.
51
52
53
54 END
55exit
56}
57
58while getopts :a:b:e:f:t:x:j: arg
59do case $arg in
60 f) file1=$OPTARG;;
61 b) part1=$OPTARG;;
62 e) ext2=$OPTARG;;
63 t) ext3=$OPTARG;;
64 x) xfs=$OPTARG;;
65 j) jfs=$OPTARG;;
66 a) allfs=$OPTARG;;
67
68 \?) echo "************** Help Info: ********************"
69 usage;;
70 esac
71done
72
73if [ ! -n "$file1" ]; then
74 echo "Missing the large file. You must pass a large filename for testing"
75 usage;
76 exit
77fi
78
79if [ ! -n "$part1" ]; then
80 echo "Missing the partition. You must pass a partition for testing"
81 usage;
82 exit
83fi
84
85if [ -n "$allfs" ]; then
86 echo "testing ALL supported filesystems"
87 ext2="1"
88 ext3="1"
89 jfs="1"
90 xfs="1"
91 echo "test run = $run0"
92fi
93
94if [ -n "$ext2" ]; then
95 echo "** testing ext2 **"
96 run0=$(($run0+1))
97fi
98
99if [ -n "$ext3" ]; then
100 echo "** testing ext3 **"
101 run0=$(($run0+1))
102fi
103
104if [ -n "$xfs" ]; then
105 echo "** testing xfs **"
106 run0=$(($run0+1))
107fi
108
109if [ -n "$jfs" ]; then
110 echo "** testing jfs **"
111 run0=$(($run0+1))
112fi
113
114if [ "$run0" -eq 0 ]; then
115 echo "No filesystems passed to test"
116 echo "Please pass at least one supported filesystem or the -a 1 flag to run all "
117fi
118
119
120mkdir /test 2&>1 > /dev/nul
121mkdir /test/aiodio 2&>1 > /dev/nul
122
123while [ "$runTest" -lt "$run0" ]
124do
125
126echo "runTest=$runTest run0=$run0 nextTest=$nextTest"
127
128if [ -n "$ext2" -a $nextTest -eq 0 ]; then
129 echo "***************************"
130 echo "* Testing ext2 filesystem *"
131 echo "***************************"
132 mkfs -t ext2 $part1
133 mount -t ext2 $part1 /test/aiodio
134elif [ $nextTest -eq 0 ]; then
135 nextTest=$(($nextTest+1))
136fi
137
138if [ -n "$ext3" -a $nextTest -eq 1 ]; then
139 echo "***************************"
140 echo "* Testing ext3 filesystem *"
141 echo "***************************"
142 mkfs -t ext3 $part1
143 mount -t ext3 $part1 /test/aiodio
144elif [ $nextTest -eq 1 ]; then
145 nextTest=$(($nextTest+1))
146fi
147
148if [ -n "$jfs" -a $nextTest -eq 2 ]; then
149 echo "**************************"
150 echo "* Testing jfs filesystem *"
151 echo "**************************"
152 mkfs.jfs $part1 <yesenter.txt
153 mount -t jfs $part1 /test/aiodio
154elif [ $nextTest -eq 2 ]; then
155 nextTest=$(($nextTest+1))
156fi
157
158if [ -n "$xfs" -a $nextTest -eq 3 ]; then
159 echo "**************************"
160 echo "* Testing xfs filesystem *"
161 echo "**************************"
162 mkfs.xfs -f $part1
163 mount -t xfs $part1 /test/aiodio
164elif [ $nextTest -eq 3 ]; then
165 nextTest=$(($nextTest+1))
166fi
167
168nextTest=$(($nextTest+1))
169runTest=$(($runTest+1))
170
171mkdir /test/aiodio/junkdir
172cp $file1 /test/aiodio/junkfile
173cp $file1 /test/aiodio/fff
174cp $file1 /test/aiodio/ff1
175cp $file1 /test/aiodio/ff2
176cp $file1 /test/aiodio/ff3
177
178
179
180echo "************ Running aiocp tests "
181echo "current working dir = ${PWD}"
182${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part1 > ${TMPBASE}/ltp-aiodio.part1
183
184${LTPROOT}/pan/pan -e -S -a ltpaiodiopart1 -n ltp-aiodiopart1 -l ltpaiodio.logfile -f ${TMPBASE}/ltp-aiodio.part1 &
185
186wait $!
187sync
188
189echo "************ Running aiodio_sparse tests "
190${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part2 > ${TMPBASE}/ltp-aiodio.part2
191
192${LTPROOT}/pan/pan -e -S -a ltpaiodiopart2 -n ltp-aiodiopart2 -l ltpaiodio2.logfile -f ${TMPBASE}/ltp-aiodio.part2 &
193
194wait $!
195
196echo "************ Running aio-stress tests "
197${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aio-stress.part1 > ${TMPBASE}/ltp-aio-stress.part1
198
199${LTPROOT}/pan/pan -e -S -a ltpaiostresspart1 -n ltp-aiostresspart1 -l ltpaiostress.logfile -f ${TMPBASE}/ltp-aio-stress.part1 &
200
201wait $!
202
203
204echo "************ Running aiodio_sparse tests "
205${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/ltp-aiodio.part3 > ${TMPBASE}/ltp-aiodio.part3
206
207${LTPROOT}/pan/pan -x 5 -e -S -a ltpaiodiopart3 -n ltp-aiodiopart3 -l ltpaiodio3.logfile -f ${TMPBASE}/ltp-aiodio.part3 &
208
209wait $!
210
211
212#!/bin/bash
213
214LIMIT=10
215
216
217echo "Running dio_sparse"
218
219var0=1
220while [ "$var0" -lt "$LIMIT" ]
221do
222echo -n "$var0 iteration on dio_sparse"
223 dirty
224 dio_sparse
225 date
226 var0=$(($var0+1))
227done
228
229var0=1
230while [ "$var0" -lt "$LIMIT" ]
231do
232echo -n "$var0 iteration on dio_sparse"
233./dio_sparse
234 date
235 var0=$(($var0+1))
236done
237
238echo "Running aiodio_append"
239var0=1
240while [ "$var0" -lt "$LIMIT" ]
241do
242 ./aiodio_append
243 date
244 var0=$(($var0+1))
245done
246
247echo "Running dio_append"
248var0=1
249while [ "$var0" -lt "$LIMIT" ]
250do
251./dio_append
252date
253 var0=$(($var0+1))
254done
255
256#echo "Running dio_truncate"
257#var0=1
258#while [ "$var0" -lt "$LIMIT" ]
259#do
260#./dio_truncate
261#date
262# var0=$(($var0+1))
263#done
264
265echo "Running read_checkzero"
266var0=1
267while [ "$var0" -lt "$LIMIT" ]
268do
269./read_checkzero
270date
271 var0=$(($var0+1))
272done
273
274echo "Running ltp-diorh"
275var0=1
276while [ "$var0" -lt "$LIMIT" ]
277do
278./ltp-diorh /test/aiodio/file
279date
280 var0=$(($var0+1))
281done
282
283
284rm -f /test/aiodio/fff
285rm -f /test/aiodio/ff1
286rm -f /test/aiodio/ff2
287rm -f /test/aiodio/ff3
288rm -f /test/aiodio/junkfile*
289rm -f /test/aiodio/file*
290rm -rf /test/aiodio/junkdir
291
292umount $part1
293
294done
295
296echo "AIO/DIO test complete " date