5e9f5fe8b0bd5f761ea381872b3d264219ec74c1
[xfstests-dev.git] / tests / generic / 113
1 #! /bin/bash
2 # FS QA Test No. 113
3 #
4 # aio-stress
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=0        # success is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
33
34 _cleanup()
35 {
36     cd /
37     rm -f $testdir/aio-stress.$$.*
38     _cleanup_testdir
39 }
40
41 # get standard environment, filters and checks
42 . ./common/rc
43 . ./common/filter
44
45 _do_test()
46 {
47     _n="$1"
48     _param="$2"
49     _count="$3"
50     _nproc="$4"
51
52     _files="$testdir/aiostress.$$.$_n"
53     __proc=$_nproc
54     [ $__proc -gt 1 ] && _param="-t $__proc $_param"
55     while [ $__proc -gt 1 ]; do
56         _files="$_files $testdir/aiostress.$$.$_n.$__proc"
57         let __proc=$__proc-1
58     done
59     rm -f $_files
60  
61     echo ""
62     echo "-----------------------------------------------"
63     echo "aio-stress.$_n : $_param"
64     echo "-----------------------------------------------"
65     if ! $here/ltp/aio-stress $_param $AIOSTRESS_AVOID -I $_count $_files >>$tmp.out 2>&1
66     then
67         echo "    aio-stress (count=$_count) returned $?"
68         cat $tmp.out
69         status=1
70         exit
71     fi
72
73     _check_test_fs
74     rm -f $_files
75 }
76
77 # real QA test starts here
78 _supported_fs generic
79 _supported_os Linux
80
81 [ -x $here/ltp/aio-stress ] || _notrun "aio-stress not built for this platform"
82
83 _setup_testdir
84
85 echo "brevity is wit..."
86
87 count=1000
88 procs=20
89
90 _check_test_fs
91
92 # the default
93 _do_test 1 "-s 120m" $count 1
94
95 # and the default with multiprocess
96 _do_test 2 "-s 10m" $count $procs
97
98 # as above, but now using direct IO
99 _do_test 3 "-s 10m -O" $count $procs
100
101 # dio with O_SYNC and unwritten extent conversion
102 _do_test 4 "-s 10m -O -S" $count $procs
103
104 # random dio writes with O_SYNC and unwritten extent conversion
105 _do_test 5 "-s 10m -O -S -o 2" $count $procs
106
107 exit