• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/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# 04/12/06 a Forth scenerio file has been added ltp-aiodio.part4
10#
11
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
19export PATH=$LTPROOT/testcases/bin:$PATH
20export TMP=${TMP:=/tmp}
21
22run0=0
23runTest=0
24nextTest=0
25runExtendedStress=0
26
27export TMPBASE="/tmp"
28usage()
29{
30	cat <<-END >&2
31	usage: ${0##*/} [ -f large_filename -b partition] [-o optional partition] [-e 1] [-t 1] [-j 1] [-x 1] or [-a 1]
32
33	defaults:
34	file1=$file1
35	part1=$part1
36        ext2=0
37        ext3=0
38        jfs=0
39        xfs=0
40      example: ${0##*/} -f MyLargeFile -b /dev/hdc1 [-o /dev/hdc2] [-a 1] or
41[-e 1] [-x 1] [-j 1] [-t 1]
42        -o = optional partition allows some of the tests to utilize multiple filesystems to further stress AIO/DIO
43        -e = test ex2 filesystem.
44        -t = test ext3 filesystem
45        -j = test JFS filesystem
46        -x = test XFS filesystem
47                    or
48        -a = test all supported filesystems, this will override any other filesystem flags passed.
49
50        - a 1 turns on the test for the above supported filesystem, just omit passing the flag to skip that filesystem.
51
52        - 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
53          but there is not a default filesystem. ReiserFS does not support AIO so these tests will not support ReiserFS.
54
55        - WARNING !! The partition you pass will be overwritten. This is a destructive test so only pass a partition where data can be destroyed.
56
57
58
59	END
60exit
61}
62
63while getopts :a:b:e:f:t:o:x:j: arg
64do      case $arg in
65		f)	file1=$OPTARG;;
66		b)	part1=$OPTARG;;
67		o)	part2=$OPTARG;;
68		e)	ext2=$OPTARG;;
69		t)	ext3=$OPTARG;;
70		x)	xfs=$OPTARG;;
71		j)	jfs=$OPTARG;;
72		a)	allfs=$OPTARG;;
73
74                \?)     echo "************** Help Info: ********************"
75                        usage;;
76        esac
77done
78
79if [ ! -n "$file1"  ]; then
80  echo "Missing the large file. You must pass a large filename for testing"
81  usage;
82  exit
83fi
84
85if [ ! -n "$part1"  ]; then
86  echo "Missing the partition. You must pass a partition for testing"
87  usage;
88  exit
89fi
90
91if [ -n "$allfs"  ]; then
92  echo "testing ALL supported filesystems"
93  ext2="1"
94  ext3="1"
95  jfs="1"
96  xfs="1"
97  echo "test run = $run0"
98fi
99
100if [ -n "$ext2"  ]; then
101  echo "** testing ext2 **"
102  run0=$(($run0+1))
103fi
104
105if [ -n "$ext3"  ]; then
106  echo "** testing ext3 **"
107  run0=$(($run0+1))
108fi
109
110if [ -n "$xfs"  ]; then
111  echo "** testing xfs **"
112  run0=$(($run0+1))
113fi
114
115if [ -n "$jfs"  ]; then
116  echo "** testing jfs **"
117  run0=$(($run0+1))
118fi
119
120if [ -n "$part2" -a "$run0" -gt 1  ]; then
121  echo "** Running extended stress testing **"
122  runExtendedStress=1
123elif [ -n "$part2" -a "$run0" -eq 1 ]; then
124  echo " ** You must pass at least 2 filesystems to run an extended AIO stress test **"
125  usage;
126fi
127
128if [ "$run0" -eq 0 ]; then
129  echo "No filesystems passed to test"
130  echo "Please pass at least one supported filesystem or the -a 1 flag to run all "
131  usage;
132fi
133
134mkdir $TMP  > /dev/null 2>&1
135mkdir $TMP/aiodio > /dev/null  2>&1
136mkdir $TMP/aiodio2 > /dev/null  2>&1
137
138while [ "$runTest" -lt "$run0" ]
139do
140
141echo "runTest=$runTest run0=$run0 nextTest=$nextTest"
142
143if [ -n "$ext2" -a $nextTest -eq 0 ]; then
144  echo "***************************"
145  echo "* Testing ext2 filesystem *"
146  echo "***************************"
147  mkfs -t ext2 $part1
148  mount -t ext2 $part1 $TMP/aiodio
149  if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
150    mkfs -t ext3 $part2
151    mount -t ext3 $part2 $TMP/aiodio2
152  elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
153    mkfs.jfs  $part2 <testscripts/yesenter.txt
154    mount -t jfs $part2 $TMP/aiodio2
155  elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
156    mkfs.xfs -f $part2
157    mount -t xfs $part2 $TMP/aiodio2
158  fi
159elif [ $nextTest -eq 0 ]; then
160  nextTest=$(($nextTest+1))
161fi
162
163if [ -n "$ext3" -a $nextTest -eq 1 ]; then
164  echo "***************************"
165  echo "* Testing ext3 filesystem *"
166  echo "***************************"
167  mkfs -t ext3 $part1
168  mount -t ext3 $part1 $TMP/aiodio
169  if [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
170    mkfs.jfs  $part2 <testscripts/yesenter.txt
171    mount -t jfs $part2 $TMP/aiodio2
172  elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
173    mkfs.xfs -f $part2
174    mount -t xfs $part2 $TMP/aiodio2
175  elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
176    mkfs -t ext2 $part2
177    mount -t ext2 $part2 $TMP/aiodio2
178  fi
179elif [ $nextTest -eq 1 ]; then
180  nextTest=$(($nextTest+1))
181fi
182
183if [ -n "$jfs" -a $nextTest -eq 2 ]; then
184  echo "**************************"
185  echo "* Testing jfs filesystem *"
186  echo "**************************"
187  mkfs.jfs  $part1 <testscripts/yesenter.txt
188  mount -t jfs $part1 $TMP/aiodio
189  if [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
190    mkfs -t ext3  $part2
191    mount -t ext3 $part2 $TMP/aiodio2
192  elif [ "$runExtendedStress" -eq 1 -a -n "$xfs" ]; then
193    mkfs.xfs -f $part2
194    mount -t xfs $part2 $TMP/aiodio2
195  elif [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
196    mkfs -t ext2 $part2
197    mount -t ext2 $part2 $TMP/aiodio2
198  fi
199elif [ $nextTest -eq 2 ]; then
200  nextTest=$(($nextTest+1))
201fi
202
203if [ -n "$xfs" -a $nextTest -eq 3 ]; then
204  echo "**************************"
205  echo "* Testing xfs filesystem *"
206  echo "**************************"
207  mkfs.xfs -f $part1
208  mount -t xfs $part1 $TMP/aiodio
209  if [ "$runExtendedStress" -eq 1 -a -n "$ext2" ]; then
210    mkfs -t ext2 $part2
211    mount -t ext2 $part2 $TMP/aiodio2
212  elif [ "$runExtendedStress" -eq 1 -a -n "$ext3" ]; then
213    mkfs -t ext3  $part2
214    mount -t ext3 $part2 $TMP/aiodio2
215  elif [ "$runExtendedStress" -eq 1 -a -n "$jfs" ]; then
216    mkfs.jfs  $part2 <testscripts/yesenter.txt
217    mount -t jfs $part2 $TMP/aiodio2
218  fi
219elif [ $nextTest -eq 3 ]; then
220  nextTest=$(($nextTest+1))
221fi
222
223nextTest=$(($nextTest+1))
224runTest=$(($runTest+1))
225
226mkdir $TMP/aiodio/junkdir
227dd if=$file1 of=$TMP/aiodio/junkfile bs=8192 conv=block,sync
228
229date
230echo "************ Running aio-stress tests "
231echo "current working dir = ${PWD}"
232sort -R ${LTPROOT}/runtest/ltp-aio-stress.part1 -o ${TMPBASE}/ltp-aio-stress.part1
233
234${LTPROOT}/bin/ltp-pan -e -S -a ltpaiostresspart1 -n ltp-aiostresspart1 -l ltpaiostress.logfile -o ltpaiostress.outfile -p -f ${TMPBASE}/ltp-aio-stress.part1 &
235
236wait $!
237
238sync
239echo "************ End Running aio-stress tests "
240echo ""
241
242if [ "$runExtendedStress" -eq 1 ];then
243echo "************ Running EXTENDED aio-stress tests "
244sort -R ${LTPROOT}/runtest/ltp-aio-stress.part2 -o ${TMPBASE}/ltp-aio-stress.part2
245
246${LTPROOT}/bin/ltp-pan -e -S -a ltpaiostresspart2 -n ltp-aiostresspart2 -l ltpaiostress.logfile -o ltpaiostress.outfile -p -f ${TMPBASE}/ltp-aio-stress.part2 &
247
248wait $!
249sync
250fi
251
252dd if=$file1 of=$TMP/aiodio/junkfile bs=8192 conv=block,sync
253dd if=$file1 of=$TMP/aiodio/fff      bs=4096 conv=block,sync
254dd if=$file1 of=$TMP/aiodio/ff1      bs=2048 conv=block,sync
255dd if=$file1 of=$TMP/aiodio/ff2      bs=1024 conv=block,sync
256dd if=$file1 of=$TMP/aiodio/ff3      bs=512  conv=block,sync
257
258echo "************ Running aiocp tests "
259sort -R ${LTPROOT}/runtest/ltp-aiodio.part1 -o ${TMPBASE}/ltp-aiodio.part1
260
261${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart1 -n ltp-aiodiopart1 -l ltpaiodio1.logfile -o ltpaiodio1.outfile -p -f ${TMPBASE}/ltp-aiodio.part1 &
262
263wait $!
264sync
265echo "************ End Running aiocp tests "
266echo ""
267
268echo "************ Running aiodio_sparse tests "
269sort -R ${LTPROOT}/runtest/ltp-aiodio.part2 -o ${TMPBASE}/ltp-aiodio.part2
270
271${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart2 -n ltp-aiodiopart2 -l ltpaiodio2.logfile -o ltpaiodio2.outfile -p -f ${TMPBASE}/ltp-aiodio.part2 &
272
273wait $!
274sync
275echo "************ End Running aiodio_sparse tests "
276echo ""
277
278
279if [ "$runExtendedStress" -eq 1 ];then
280echo "************ Running fsx-linux tests "
281sort -R ${LTPROOT}/runtest/ltp-aiodio.part3 -o ${TMPBASE}/ltp-aiodio.part3
282
283${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart3 -n ltp-aiodiopart3 -l ltpaiodio3.logfile -o ltpaiodio3.outfile -p -f ${TMPBASE}/ltp-aiodio.part3 &
284
285
286
287wait $!
288sync
289fi
290
291dd if=$file1 of=$TMP/aiodio/file2      bs=2048 conv=block,sync
292dd if=$file1 of=$TMP/aiodio/file3      bs=1024 conv=block,sync
293dd if=$file1 of=$TMP/aiodio/file4      bs=512  conv=block,sync
294dd if=$file1 of=$TMP/aiodio/file5      bs=4096 conv=block,sync
295
296
297
298
299echo "************ Running dio_sparse & miscellaneous tests "
300sort -R ${LTPROOT}/runtest/ltp-aiodio.part4 -o ${TMPBASE}/ltp-aiodio.part4
301${LTPROOT}/bin/ltp-pan -e -S -a ltpaiodiopart4 -n ltp-aiodiopart4 -l ltpaiodio4.logfile -o ltpaiodio4.outfile -p -f ${TMPBASE}/ltp-aiodio.part4 &
302
303wait $!
304sync
305echo "************ End Running dio_sparse & miscellaneous tests "
306echo ""
307
308echo "************ Cleaning/Umounting"
309
310rm -f $TMP/aiodio/fff
311rm -f $TMP/aiodio/ff1
312rm -f $TMP/aiodio/ff2
313rm -f $TMP/aiodio/ff3
314rm -f $TMP/aiodio/junkfile*
315rm -f $TMP/aiodio/file*
316rm -rf $TMP/aiodio/junkdir
317
318umount $part1
319
320if [ "$runExtendedStress" -eq 1 ]; then
321      umount $part2
322fi
323
324
325done
326date
327echo "AIO/DIO test complete "
328